cocos2dx android studio edit configuration - java

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 )

Related

Creating flutter plugin for android and ios gives error in java files android studio

I created a flutter plugin for android and ios using the following command:
flutter create --org com.docscanner.ds --template=plugin --platforms=android,ios -i swift -a java complete_pdf_tools
The operation was carried out smoothly and then I opened android studio and clicked on the option Open and selected the folder created by the above command. The project opened but it shows error everywhere in all the .java files.
And also all the folders and files on the left are in yellow except lib folder.
This is how it looks:
I tried Invalidate Caches and android studio restart and system restart but no good. If I move cursor on top of any red colored word for example on embedding in 3rd line it says Cannot resolve symbol 'embedding' and for actions it suggests Find JAR on web and if I click on that action it says looking for Libraries and then says No libraries found for 'import io.flutter.embedding.engine.plugins.FlutterPlugin;'
The error is in .java files only. Same thing happens if I try to create the plugin from android studio itself by going New Flutter Project>and then it asks me for flutter sdk path, which is C:\src\flutter>now for project type i select plugin and select java for android and swift for ios, give project name, org name and finish
I am using windows 10 x64, flutter version stable 2.10.2, and Android Studio version Bumblebee 2021.1.1 Patch 1
What could be the cause of these errors.
Open example/android/build.gradle instead of android/build.gradle, then you have both app and plugin in your Project.

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.

Create Android Project Folder Using Command Line in mac

Hello Android Developers,
I know from Android SDK , JDK and Gradle, we can create APK using command line but we still create project folder through Android Studio or other IDEs.
Can someone help, how to create android project folder using command line in mac?

Correct way to build JAR files for Android Studio?

I've created a simple library to get JSON responses and map it to Java Object.
I built a JAR using 'build with dependencies' in IntelliJ IDEA with JDK 1.8. However, this JAR works when used with other IntelliJ IDEA projects.
However when I add in Android Studio Project, I get this Error:com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
I found on Reddit that some user did the same (built JAR with IntelliJ Idea and Imported in Android Studio)
I think I am missing something or a way to create JAR file which is causing incompatibility to Android Studio. I'm pounding my head for hours with no luck.
For Android Studio, change File -> Project Structure -> SDK Location -> JDK Location to jdk1.7.x. For the command line, ensure java -version outputs java version "1.7.x".

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