2016-10-18 44 views
5

Android Studio'da bir uygulama kodum var, kütüphane projesine dönüştürmek istiyorum, böylece başka bir uygulamada kütüphane olarak kullanabilirim.
Hata: Ben robot stüdyo 2.2.1 ve jdk 1.8 kullanıyorumAndroid kitaplığı projesi için jackOptions nasıl kullanılır

apply plugin: 'com.android.library' 
apply plugin: 'com.google.gms.google-services' 
android { 
    compileSdkVersion 24 
buildToolsVersion "24.0.3" 
defaultConfig { 
    //applicationId "com.example" 
    minSdkVersion 16 
    targetSdkVersion 24 
    versionCode 1 
    versionName "1.0" 

    jackOptions { 
     enabled true 
    } 
    multiDexEnabled true 
} 
dexOptions { 

    javaMaxHeapSize "4g" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 

} 
} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
    exclude group: 'com.android.support', module: 'support-annotations' 
}) 
testCompile 'junit:junit:4.12' 

/* support libraries*/ 
compile 'com.android.support:appcompat-v7:23.1.0' 
compile 'com.android.support:design:23.1.0' 
compile 'com.android.support:recyclerview-v7:23.1.0' 
compile 'com.android.support:support-v4:23.1.0' 
compile 'com.android.support:support-annotations:23.1.0' 

/* google play services libraries*/ 
compile 'com.google.android.gms:play-services-location:9.0.0' 

} 

,
jdk 1.8 jackOptions

diyor gerektirir şöyle kütüphane projesinin
build.gradle olan Kütüphane projeler Jack'i etkinleştiremez. Jack, varsayılan yapılandırmada etkinleştirilmiştir. 0Options Eğer jackOptions'ı devre dışı bırakırsam, kütüphanem jdk 1.8'e bağlı olarak çalışmıyor, jackOptions gerekli ve aşağıdaki hataları alıyor. Olivier M. için

app:generateDebugSources 
app:mockableAndroidJar 
app:prepareDebugUnitTestDependencies 
app:generateDebugAndroidTestSources 
myapplication:generateDebugSources 
myapplication:generateDebugAndroidTestSources 
myapplication:mockableAndroidJar 
myapplication:prepareDebugUnitTestDependencies 

cevap

0

sayesinde, burada çalışan bir geçici çözüm vardır: Is there way to use Java 8 features with Android library project?.

ithalat parçasıdır: ayarlarında

// Java8 not fully supported in library projects yet, https://code.google.com/p/android/issues/detail?id=211386 
// this is a temporary workaround to get at least lambdas compiling 
gradle.projectsEvaluated { 
    tasks.withType(JavaCompile) { 
     options.compilerArgs << "-Xbootclasspath/a:" + System.properties.get("java.home") + "/lib/rt.jar" 
    } 
} 
+0

. ? – jenuine

1

Yinelenen girişi. Sadece aşağıdaki satırları build.gradle'dan kaldırın: modül veya proje içinde

jackOptions { 
     enabled true 
} 
İlgili konular