I am getting error 'Caused by: org.gradle.process.internal.ExecException: Process 'command '/home/ec2-user/jdk1.8.0_45/bin/java'' finished with non-zero exit value 2' when submitting an Android build request.
I suspect it has got to do with Flurry CN1Lib
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':transformClassesWithDexForRelease'.
Caused by: java.lang.RuntimeException: com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --verbose --force-jumbo --num-threads=4 --output
The flurry cn1lib needs to be updated to use the newer Android API level 28 for location which is our current default. That's the right thing to do for the long term.
As a short term patch you might be able to define: android.playServicesVersion=8.3.0 in the build hints to work around this. Notice that this might impact the functionality of your app such as location services support etc.
Well, I finally managed to fix this issue. I was only interested on getting the analytics bit working but I believe Ads should work too. Here is how I did it:
Cloned/downloaded the current CN1Flurry project from GitHub here https://github.com/chen-fishbein/flurry-codenameone. This allowed me to access the source files and use them for reference.
Importing the project as is into my Netbeans was bringing some 'resolve project' issues so I just went ahead and created a new project with similar name and package/class structure as CN1Flurry then copied classes from old project into the new one.
Open the FlurryNative class and delete the onPageView(), setLogEvents() and setCrashReportingEnabled() as these aren't supported by current Flurry Android SDK. Once done, right-click on the FlurryNative class and choose 'Generate Native Access'. This will allow you to create native implementations for Android, iOS, Windows etc in the 'native' folder of the project.
Chen's project uses version 5.3.0 of Flurry SDKs but the recommended SDK version is version 12.1.0. Download the latest aar files from your Flurry portal under the 'Admin' section and copy them to the 'android' folder. For me these were flurryAds_12.1.0.aar and flurryAnalytics_12.1.0.aar
Switch to the Files view of your Netbeans project and open the FlurryNativeImpl class. You can copy most of the implementations from Chen's project the only thing you need to change is the initFlurry() method to - new FlurryAgent.Builder().build(AndroidNativeUtil.getActivity(), apiKey); Flurry is initialized differently in the new SDK - https://developer.yahoo.com/flurry/docs/integrateflurry/android/
That's it. Switch back to the 'Projects' view then clean and build your CN1Flurry project to generate the .cn1lib file which you can then add to your UI project in the 'libs' folder. Remember to refresh cn1Libs files.
Finally, add the following build hints to your UI project:
android.min_sdk_version=16
android.multidex=true
android.xapplication=\<activity android:name="com.flurry.android.FlurryFullscreenTakeoverActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"> \</activity>
Chen suggests a whole lot of other build hints to add but I didn't find them useful for my case.
Still learning the ropes on how GitHub works; will make a pull request once I get comfortable. Meanwhile, you can get the entire project here - https://drive.google.com/open?id=1GGygaVelmMhMUX9Deik9W72hXkw_detG
Related
I was trying to use opencv library, so I imported one of its projects in Android Studio and when I tried to run it I got this error:
Error:Execution failed for task ':openCVSamplefacedetection:compileDebugNdk'.
NDK not configured.
Download the NDK from http://developer.android.com/tools/sdk/ndk/.Then add ndk.dir=path/to/ndk in local.properties.
(On Windows, make sure you escape backslashes, e.g. C:\ndk rather than C:\ndk)
So I downloaded the ndk and I addes this line to the local.properties file where it became:
sdk.dir=C\:\\Users\\skoon\\AppData\\Local\\Android\\sdk
ndk.dir=C\:\\Users\\skoon\\AppData\\Roaming\\IDM\\android-ndk-r10d
but I still got this error which I didn't understand:
Error:Execution failed for task ':openCVSamplefacedetection:compileDebugNdk'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\skoon\AppData\Roaming\IDM\android-ndk-r10d\ndk-build.cmd NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Users\skoon\Downloads\Compressed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\build\intermediates\ndk\debug\Android.mk APP_PLATFORM=android-14 NDK_OUT=C:\Users\skoon\Downloads\Compressed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\build\intermediates\ndk\debug\obj NDK_LIBS_OUT=C:\Users\skoon\Downloads\Compressed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\build\intermediates\ndk\debug\lib APP_ABI=all
Error Code:
2
Output:
make.exe: *** No rule to make target 'C:\Users\skoon\Downloads\Compressed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\build\intermediates\ndk\debug\obj/local/arm64-v8a/objs/detection_based_tracker/C_\Users\skoon\Downloads\Compressed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\src\main\jni', needed by `C:\Users\skoon\Downloads\Compressed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\build\intermediates\ndk\debug\obj/local/arm64-v8a/objs/detection_based_tracker/C_\Users\skoon\Downloads\Compressed\OpenCV-2.4.10-android-sdk\OpenCV-2.4.10-android-sdk\samples\face-detection\openCVSamplefacedetection\src\main\jni\DetectionBasedTracker_jni.o'. Stop.
I didn't change anything in the code, so what should I do? do I need to change or add any variables to point to the ndk?
P.S. This is my first time trying to build Android application so I don't have any experience.
Thank you in advance.
UPDATE:
To import the project I just used import project from file, then I synced the gardle, and run the project.
the package that I downloaded from opencv was the Android one, and I tried to use the face detection sample.
when I run it I got the error above.
You need to setup OpenCV librairies for your project. You can follow the instruction here.
OpenCV sample projects haven't support gradle officially. I think it will be easier if you start a new project and configure it to work as in examples.
I have implemented a tutorial project using Android Studio + NDK + OpenCV. You may have a look. https://github.com/quanhua92/NDK_OpenCV_AndroidStudio
Install NDK in your SDK manager, if you already installed open app's "build.gradle" replace these lines
sourceSets { main { jni.srcDirs = ['src/main/jni', 'src/main/jniLibs/', 'src/main/jni/'] } }
to
sourceSets.main {
jniLibs.srcDir 'src/main/jniLibs' // mention your JNI lib path(where ".so" files contains)
jni.srcDirs = [] //disable automatic ndk-build call
}
I'm tried to configure OpenCV and its fixed
I write a android app in Eclipse and use run command on my cellphone.
It's run success on my cellphone.
But I use [Android Tools -> Export Signed Application Package...] to export my app.
Then use [adb install] to install apk on my cellphone and run.
And I got the error message:
07-22 11:20:43.537: E/AndroidRuntime(20216): Caused by: java.lang.ClassNotFoundException: com.mytest.MyActivity in loader dalvik.system.PathClassLoader[/data/app/com.mytest-1.apk]
In [Java Build Path -> Order and Export], I have been selected all.
In AndroidManifest.xml, the application attribute doesn't have android:name.
I don't know how to solve this problem.
I'm success use Eclipse run on my cellphone, why run error when I export the app?
please help me, thanks!!
I had same issue, after 2 hours of research I managed to fix this problem by deleting "bin" and "gen" folders and rebuilding project.
There seems to multiple reasons for this happening from what I have researched. Do you have a lib folder? if so change it to "libs".
Do you have proguard enabled? If so that may cause the problem.
Also try unchecking the "Android #.#.#" and "Android Dependencies" in your Build Path, Order and Export.
Check out this thread which has a bunch of other possible solutions, a lot of them deal with setting the proper ActivityName in the manifest file.
java.lang.ClassNotFoundException on working app
If those solutions still don't solve the problem try these threads.
Android: Unable to instantiate activity / ClassNotFoundException
ClassNotFoundException Android
What I had to do is just re-do the building/exporting process with no modification to the code whatsoever. It worked for me, which I did was to export it two times.
On my first export, the build APK has lower file size and the second export (with no any modification to the code/configuration) produced a slightly larger file size (about 200KB diff).
This bug in building is really costly, kills you in front of your manager, and should be really fixed by Android/Eclipse team. Kind of sucks
I am using this guide to try and port my JavaFX application to Android.
I have downloaded and installed all the things that the guide says I need but when I run the command:
gradle -PDEBUG -PDIR=/home/josh/cs335Android -PNAME=AndroidTimeline -PPACKAGE=src -PJFK_SDK=/home/josh/android-sdk -PJFX_APP=/home/josh/git/TimelinePhaseTwo -PJFX_MAIN=src/gui/Driver createProject
it says:
A problem occurred evaluating root project '***android-tools***'.
Cause: Could not find property '***ext***' on task '***:conf***'."
I think this is because I am not properly supplying the parameters to gradle (as described in the guide) but I don't actually know how to do that. Are those something that I write in the build.gradle file?
After searching for similar questions/answers without success I'll try to explain my situation.
I've an Andorid game developed with LibGDX, which also uses the Google Play Games services.
My game is composed by several projects:
google-play-services_lib (lib project provided by Google, unmodified)
http://i.stack.imgur.com/1XnHn.png (libs)
http://i.stack.imgur.com/Gay5H.png (buildpath)
BaseGameUtils (lib project provided by Google, unmodified. depends on 1)
http://i.stack.imgur.com/3iJ0W.png (libs)
http://i.stack.imgur.com/noNDX.png (buildpath)
odd-blocks (the principal project of the game)
http://i.stack.imgur.com/atsKA.png (libs)
http://i.stack.imgur.com/5MDua.png (buildpath)
odd-blocks-android (basically the main activity class, depends on 1, 2, and 3)
http://i.stack.imgur.com/VUxJt.png (libs)
http://i.stack.imgur.com/yP6wv.png (buildpath)
odd-blocks-desktop (for testing the game on desktop mode, depends on 3)
http://i.stack.imgur.com/pKGUf.png (libs)
http://i.stack.imgur.com/9XzdM.png (buildpath)
My problem is that, with the configuration shown, when I try to execute the odd-blocks-android project I obtain the following error:
[2014-03-08 19:04:22 - Dex Loader] Unable to execute dex: Multiple dex files define Landroid/support/v4/accessibilityservice AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
[2014-03-08 19:04:22 - odd-blocks-andorid] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
Which is related to the "andorid-support-v4.jar", I'm sure to have only one version of this jar, as you can see in the images. There is a "solution" proposed in some questions to disable the private libraries in the build path configuration. In my case, if I do that, the game is executed but before starting there is a exception that says:
03-08 18:26:05.524: E/AndroidRuntime(15449): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.damsoft.oddblocks/com.damsoft.oddblocks.MainActivity}: java.lang.NullPointerException
There are also, some questions available about this second error message, that mentions that it is because the manifest is incorrect because does not have the activity registered. I'm sure that this is not my case, because I checked it, and also because my game worked before. In these questions they also mention that a way to resolve this error is to enable the "android private libraries" in the build path configuration screen, but then, I got the first error...
It is also important to mention that this error started to happen after the update to "Android SDK build-tools" v19 (currently 19.0.3).
I've been trying many things but nothing seems to solve the issue, maybe is something stupid... I don't know, but I'm out of ideas. I hope you can help :)
Finally I found the problem.
It was the "gdx-backend-android.jar", and some bad luck.
I installed a nightly build of LibGDX that for some reason included the classes of the android-support-v4.jar that caused the conflict of versions.
My solution was as simple as re-download libgdx.
But as a general remark, it is important to notice that this error message could mean that some other lib includes duplicated classes. Not necessarily with the same file name. The only way I found to check this was to rename the jar files to zip, and check for the duplicated class files.
I am being driven mad the following (apparently hard) error from eclipse.
Publish failed using Ant publisher
Resource is out of sync with the file system: '/MyServlet/build/classes/com/inver/hotzones/database/BaseNetworkData.class'.
I have seen comments on similar errors where refreshing eclipses view of the project helps but it is not helping me. Have tried cleaning the project, removing it from the webserver, deleting war files but cant seem to clear it. I have reset my TMPDIR variable so that it uses a directory on the same filesystem as that appeared to be another possible cause.
The error occurs on classes which have been enhanced by datanuculeus. I have auto-enhance on the project. The other references to this problem indicate that it is due to Eclipses view of the project being out of step with the filesystem, and I am guessing that this has something to do with thedata nucleus enhancement.
Any ideas?
Thanks.
I am using Eclipse 3.5.2 with latest datanucleus pluggins.
Stack trace
org.eclipse.core.runtime.CoreException: Resource is out of sync with the file system: '/MyServlet/build/classes/com/inver/hotzones/database/BaseNetworkData.class'.
at org.eclipse.jst.server.generic.core.internal.publishers.AbstractModuleAssembler.copyModule(AbstractModuleAssembler.java:172)
at org.eclipse.jst.server.generic.core.internal.publishers.WarModuleAssembler.assemble(WarModuleAssembler.java:31)
at org.eclipse.jst.server.generic.core.internal.publishers.AntPublisher.assembleModule(AntPublisher.java:167)
at org.eclipse.jst.server.generic.core.internal.publishers.AntPublisher.publish(AntPublisher.java:128)
at org.eclipse.jst.server.generic.core.internal.GenericServerBehaviour.publishModule(GenericServerBehaviour.java:82)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModule(ServerBehaviourDelegate.java:949)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModules(ServerBehaviourDelegate.java:1039)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:872)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:708)
at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:2731)
at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:278)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)