Deployment problem with new 1.3.0


#1

@hideki Problem! With the new 1.3 version, I cannot deploy my app to device. It builds the project fine, but trying to build & deploy the apk produces errors (as follows) basically that it doesn’t like the fact the the new version was compiled with Java 8. It took me a few hours until I realized that CBL was the culprit.
Although the Android build script suggest trying to set ‘compatibility to 1.7’, it did not help.
I tried this back and forth a few times, With 1.2.1 it works ok, with the new 1.3 it does this:

Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the ‘java’ gradle plugin in a library submodule add
targetCompatibility = '1.7’
sourceCompatibility = '1.7’
to that submodule’s build.gradle file.
:app:transformClassesWithDexForDebug FAILED
Error:1 error; aborting
Error:Execution failed for task ‘:app:transformClassesWithDexForDebug’.

com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘C:\opt\jdk1.8.0_25\bin\java.exe’’ finished with non-zero exit value 1
— end quote ----

Now truth be told, possibly I am not including that 1.7 setting in the correct place, but I did try numerous ways based on googling StackOverflow, to no avail. Maybe you can tell me exactly where to include the 1.7 clause. Other than that, I’m back to 1.2.1

Thanks
nat


#2

For Android N, we switched to use JDK 1.8 on the build server. Some of our community users already started to use developer preview version of CBL Android 1.3.0. However, I have never heard this issue till today.

Don’t you mind to share your bulid.gradle?

Thanks!


#3

I tested with ToDoLite for Android sample app. I could not reproduce the issue you have encountered.

Could you please refer our sample app build.gradle file?


#4

Off the bat (am not at my developer console now) I can say that on my end I do NOT have SDK and Tools versions (compileSdkVersion 24 buildToolsVersion “24.0.0”) at 24. I have them set at 23 (due to a Studio Gui designer bug when its at 24) for projects and dependencies. Since I am not targeting “N”, version 23 is just fine for me. I’m afraid though that I cannot test with it at 24, because I have many many dependent projects and libs which all have to be set at the same version for it to build smoothly.

nat


#5

@hideki ok. (back to work.)
Here are two related build files:

  1. The app’s build file:
    https://gist.github.com/natgross/710568c13ae552843b3ade44687a6580

  2. My ‘base’ cbl lib project:
    https://gist.github.com/natgross/5ce53afc8b6cda9e8f557ddfddd09230


#6

Both build.gradle files points to 1.2.1.

We will test our sample app against Android M (API 23).


#7

@hideki, Of course [it point to 1.2.1]. I told you that I had to change it to 1.2.1 in order to work!
But that exact file, if you change the 1.2.1 to 1.3.0, it bombs.

nat


#8

Hi @hideki;
[Now that 1.3.0 is official,] Any update on this?
Any workaround?
Is there a 1.3.1 that solves this?
Thanks
nat


#9

@natgross what Java and Android studio version are you using? If you are using Android Studio 2.1, can you upgrade to use Java 1.8 as a workaround?


#10

@hideki @pasin
UPDATE ON THIS PROBLEM:
But first, I am using Android Studio 2.1.2, and although I cannot get the ide itself to use jdk 8 for its own code, I was able to tell it to use jdk 8 for my CB lite projects. Also I changed my target Android version (of this and all dependent projects) to android sdk 24.

My error message has changed pointing to a specific bug in forestdb, as follows.:
Error:PARSE ERROR: Error:unsupported class file version 52.0 Error:...while parsing com/couchbase/cbforest/Constants.class Error:1 error; aborting :app:transformClassesWithDexForDebug FAILED

So, I commented out the forestdb, as follows:
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:24.0.0' compile 'com.couchbase.lite:couchbase-lite-android:+' //<-------- This line works! //compile 'com.couchbase.lite:couchbase-lite-java-forestdb:+' <----- This line commented out. }
With this configuration, I now CAN deploy a 1.3.0 CBL app. But of course without forestdb.

Thanks;
nat


#11

@hideki and @pasin
Problem SOLVED. (Sort of.)
version 52 = jdk 8.
Here is the deal: