Android compile loop after added .jar files which use java 8

67 Views Asked by At

I need to use same nlp libraries in my android application. In particular these libraries need java 8. I added the .jar files in android project, added

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.kekko.nlp_api_25"
        minSdkVersion 25
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        jackOptions {
            enabled true
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

to the app.grandle, but when I run the project, the Grandle console go in loop with :app:transformClassesWithPreJackPackagedLibrariesForDebug

1

There are 1 best solutions below

4
On

Try Compiling it with making gradle offline

Fixed it by going to Android Studio -> Preferences -> Gradle -> and ticking Offline work. at least now it will run.

Edit: In new Android Studio Versions the path is File -> Other Settings -> Default Settings -> Build-Excecution-Deployment -> Gradle

One more thing, please do check the the .jar file also. sometimes the source you downlaod the jar file is not accurate and some files missing in your jar file cause errors. this happened to me once when i was working on java project.