Flutter Example Starter code with Main.Dart vs. .java - 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.

Related

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 )

UIautomator - Android Studio - How to generate an APK or JAR file

I have a project in Android Studio, using UIAutomator, but I don't want to open Android studio everytime I need to run it.
How can I generate a APK, Jar file or anything that can be launched? I don't want smart or safe methods, but the simple the better. It has to be using Android Studio, not eclise or any other IDE.
It generates APK, but it doesn't open properly, I don't have any GUI coded, just test classes.
Thanks,
Only way you can achieve this by storing APK on your android mobile, here is simplest way to do so
Connect your android mobile and choose the device as emulator while running the project,by doing this you will find APK installed on your mobile device that you can run anytime you want.
here are steps to follow :-
https://www.youtube.com/watch?v=Qb2olFyoMV4

Generate Java android project with sencha

My question is:
It is possible to generate a java android project structure (with uncompiled classes .java) with Sencha Cmd?
I think Sencha Cmd must do that to generate an APK. It's the Android SDK that generate the APK.
I need to modify the android project before build it because Sencha is limited in interaction with the phone. (It's impossible to download a file form a generated APK by exemple... I need to do that)
If it's possible, what command or manipulation do I need to do?
Thank you for any help that can head me to the solution.
I finally used Cordova to compile my application, it responded to my needs.
Cordova allows to download and execute files.

What target environment should I use to compile android Camera app code?

I am a .NEt developer but recently i am having to deal with some android /java code. I downloaded Android OS's camera app source code from following location:
https://android.googlesource.com/platform/packages/apps/Camera
Now, I am having these files on my Windows 7 machine. When I do a simple search of "How to compile android apk code on windows" most of the searches result in saying that it is very non trivial and I need Mac or Unix machine for it.
Now, Looks like this is all bunch of java files. But I am not sure what should b emy target environment to try to compile all these files?
Follow these steps:
Download adt bundle here
Extract the zip and start ecllipse ide
Create a new emulator on which you run your application. It looks like a mobile icon.
then goto file->import->android->existing android project to workspace
Browse to your downloaded location select your project
Run

Categories

Resources