How to deal with flutter Java/Kotlin - java

I just noticed my flutter app, the android version is in Kotlin, that is the kotlin directory contains the MainActivity.kt
If I did this, it was a mistake because I don't know any Kotlin.
I would prefer my android app in Java, which is the MainActivity.java under the java folder.
How do I go about changing things so my android app is in Java?

Since the latest version of flutter the android project is created with kotlin by default. You can change this deleting the android folder and recreating it running the command below in the root of your project.
flutter create -a java .

Related

I Can't Run a Java Module on Android Studio

So I am very much a newcomer to the android studio, so I might've missed a few settings here and there, but
when I try to run a code with created java module, it doesn't recognize any of my code.
I attached the screenshot of what the ide returned to me.
I tried to reinstall the newest version of the android studio with the newest version of SDK (I attached another image file.) several times, but it doesn't seem to go anywhere.
For the SDK tools, I have the followings:
Android SDK Build-Tools
Android Emulator
Android SDK Platform-Tools
Also, I did try Build>Cealn Project.
Does anyone know how to fix this problem?
P.S. Here is my build gradle for the java module.

Now that the android command is deprecated how to should i create android apps without android studio

I wanted to work without android studio as it really slows my laptop down.So I after research I got to the deprecated android command.As it is deprecated ,Is there another way to create android apps without android studio
I also looked at cookie-cutter and similar apps.They all have one problem-They don't dynamically update the android gradle plugin on updates and are also separated from the android command line tools
Some more information about your project could be useful.
If you're using Gradle, each of your build variants/flavors will have a command for building.
More information can be found here:
https://developer.android.com/studio/build/build-variants
and
https://developer.android.com/studio/build/gradle-tips

Flutter Example Starter code with Main.Dart vs. .java

If an example app has both a main.dart file and .java & build.gradle files does that mean that there are two redundant ways for the example app to be run on an emulated Android device?
I can currently run the main.dart file on an emulated device in Android Studio, but when I try running the .java file it give me the error "Error: Gradle project sync failed. Please fix your project and try again."
It seems like the .java and gradle files directly compile to an Android .apk program when run, but my intuition was that the Dart code could also be compiled to an apk or ipa program.
When you make a new Flutter project it generate dart, android and iOS (if on a mac) code. For the most part we dont have to touch the underlying Java code.
But if you must you can open just the android folder in android studio and let gradle sync and build the project. You may also want to write platform specific code for either android or iOS.
Here is a guide on how you can do that https://flutter.dev/docs/development/platform-integration/platform-channels
tl;dr;
flutter generates native code for your dart code. You can also access native hardware by writing platform specific code.

Flutter+Android Studio: Can't resolve Java symbols from external libraries

I'm trying to build a Flutter app that also runs custom Java code, so that I can execute code in the background, set alarms etc. As such, I'd like to access Firebase from Java.
I've created a new Flutter project in Android Studio and added Firebase as documented here (manually).
It compiles and runs fine on the device, but it seems that the dependency .jars from Gradle are not picked up in Android Studio, and as a result my Java source files show a lot of errors - source being "cannot resolve symbol 'google'" in the import statements.
Is there anything special that I need to do in order to have Android Studio pick up external Java dependencies from Gradle in Flutter application projects? I'm running Android Studio 3.0 Beta 7.
I have the same issue and would love to find the solution. I tried directly downloading the .aar file and using this guide but it did not work either.
https://github.com/yushulx/flutter-android-aar
Edit: I found an open issue on the topic which can be found here. Clearly you have found it, but in case anyone else is looking for more information about this.
Edit 2: Here is a workaround.

cocos2dx android studio edit configuration

I had install all cocos2dx requirements for that . when I create an cocos2dx project this directory's created :
now I want to open it on the android studio . now when I open the proj.android-studio I can't run project and it's need to edit configuration . now which configuration should i do for run this hello world game ?
and consider this I am completely new in cocos2dx .
thanks for any help
Unfortunately there isn't a strong support for the Android Studio. You should first compile using
cocos compile -p android --android-studio
You should run this command in the projects home directory (that contains Classes, proj.android-studio... folders)
After running this, cocos will create an .apk file in the bin/debug folder.
You can try to run this .apk on your device or to get different builds you can import the proj.android-studio to the Android Studio and change the settings. But whenever you change a file in the classes folder, you have to compile it again.
For convenience, I am keeping two IDE (Visual Studio and Android Studio) and command line open. I am editing my c++ files in Visual Studio, I am compiling the code through command line, then I am trying to debug with Android Studio.
Drag and drop your project in command promte.Then run "cocos compile -p android --android-studio".For more information refer this video link
Now you can use Android Studio for game development using Cocos2dx
Requirements -
Cocos2dx-3.16
Android Studio (v3.0.1)
Update Android SDK (Update API 23 to API 19) Recommended
NDK r14b (Do not use r16. It has compatibility issue with cocos2dx)
python (2.7.14)
Steps-
Install python ( While installation use Add path to all local hard
drive )
Read readme.md file to configure the basic requirements for project ( Like setting environment path )
Create new Cocos2dx cpp project
Import the proj.android-studio folder into Android Studio
Change the supported platform. If you got any error
Configure project settings. Click Open->Project structure and put Min and Max API support
Modify Android.mk. Refer this
https://stackoverflow.com/a/48045723/2052113
Build project
Run Project ( Your sample android game is ready )

Categories

Resources