How to run cocos2d-x v3.7 projects on Android Studio - android

cocos2d-x V3.7 supports Android Studio, but I'm unable to run even the test app. Everytime I deploy the app on my Android device and try to run, my device gives and error "Unfortunately, libcocos2dx has stopped". I think I'm doing it the wrong way. Can anyone guide me with how to run the project properly?

Android Studio cant build with ndk yet, so what i do, is import proj.android on Android Studio, and then compile in console in the root of you project:
Cocos compile -p android
And now you can Debug and install the apk file on android studio, just click debug and play, no more crashes, but if you modify any file ,you need to compile again in cocos console, and install the apk again VIA Android studio Debug.

break point work in java file in android studio.break point in cpp file is not consider in debug.Try to debug build_native.sh file in console and then run your project

Related

How to run source code of an Android app downloaded from Github without the use of an IDE?

So I would like to do it without importing the project into Android Studio. Is it possible?
if the project build with Gradle
install Android SDK
install Gradle
open Terminal switch to the project directory,use command "gradle build "
If there's an APK included you can just install the APK using ADB.

Cocos2d-x and Android Studio

I'm very new to cocos2d-x development, and I also never built anything on Android.
I followed many text guides that seem to be outdated and not using Android Studio, but Eclipse instead as an IDE. I downloaded all required components (NDK, Ant, JDK), and I'm not sure where to use them in this IDE itself. When I built on iOS, my project worked just fine. When it was time to test it on Android, I followed this video guide http://www.youtube.com/watch?v=VLeGy1foMQA . My project kept crashing with "Unfortunately, projectname has stopped" message. Compiler never showed anything resembling an error report (or something that looks like one).
I'm very confused right now. Someone please give me a step-by-step guide on how to compile cocos2d-x projects on Android (I'm using a Mac).
You don't need a IDE to compile cocos2d-x projects on Android. You just have to use a command like:
cocos compile -s /your_cocos_project_path -p android -o /your_cocos_output_path
If you want to load your Android project in a IDE, you should have the following folders in your cocos2d-x project:
proj.android
proj.android-studio
proj.ios_mac
...
For Eclipse you can import the project from proj.android folder and for Android Studio from proj.android-studio.
Then if you want to generate the apk from proj.android just execute the command that I wrote at the beginning. If you want to generate the apk from proj.android-studio, execute a command like:
cocos compile -s /your_cocos_project_path -p android --android-studio -o /your_cocos_output_path

cordova 5.0 generate signed apk

I use Cordova 5.0.0 to develop android app and I would like to run the app on real machine.
I tried two ways to generate signed apk but failed,
One is used command line to sign an apk that generated by cordova. by this way, it will cause "parsing error" when install the apk;
The second way I tried is using android studio to generate signed apk. My step is "import non-android studio project" then generate signed apk. By this way, I install successfully but the app can't be open and popup error info "unfortunately, xx has stopped".
There is no problem with the code.
Anyone can give me some suggestion? Thanks.
Cordova 5 uses gradle to compile now, so the old ant.properties no longer works. You can work the same trick by creating a release-signing.properties file in platforms/android and adding the following:
storeFile=<path to="" .keystore="" file="">
storeType=jks
keyAlias=<your key="" alias="">
// optional :
keyPassword=<your-key-password>
storePassword=<your-store-password>
If you used Android Studio, you can try with Intellij IDEA (Android Studio is performed by Intellij Platfrom ) here.
After importing your projet, simple go to :
Build > Generate Signed APK..
You'll need to create a key and then Intellij will create your APK.
If you still have your error "unfortunaly..." connect your device and check Intellij logs.

Phonegap won't compile

I had a working phonegap project which I compiled using
phonegap build android
And then aligned and signed using ant
ant release
However, I had to format my computer, saved the folder on another drive, and copied it back after formatting. I installed jdk, android sdk, phonegap, ant, and when I try to compile it again (using the same command as before) I'm getting this error (which doesn't help at all, not even with --verbose):
[error] An error occurred while building the android project.
What do I need to do to be able to compile the project again? Also, do you recommend using an IDE instead of the phonegap CLI?

Plugin Development for Android 2.3

I am new to Android and using Android 2.3 .
There is sample Browser plugin in the source code I am trying to build
it but unable to do so.
To compile plugin [ In README.txt ]
run "make SampleBrowserPlugin" (compiles libsampleplugin.so and
builds the apk)
the previous command produces an apk file so record its location.
Using the above steps I am unable to build it.
I have tried the following things :-
I thought to build the code in JNI folder first so as to get the
plugin ".so" so that after getting the ".so" would build the project
apk using the eclipse .
I tried building the code in the JNI folder using NDK build.The code
was not geting build it was giving "undefined reference to
JNIRegisterNativeMethod in JNIHelp.h "
Can anyone tell me how to build the Sample plugin and install it
on Emulator.
You need to "make SampleBrowserPlugin" from the root of your source installation (on a Linux machine). That is, the same directory that contains "bionic", "build", "dalvik", etc. as child directories.

Categories

Resources