简体   繁体   中英

Flurry CN1Lib error after submitting Android build

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:

  1. 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.
  2. 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.
  3. 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.

  4. 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

  5. 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/

  6. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM