2016-10-18 16 views
5

मेरे पास एंड्रॉइड स्टूडियो में एक एप्लिकेशन कोड है, जिसे मैं इसे लाइब्रेरी प्रोजेक्ट में कनवर्ट करना चाहता हूं ताकि मैं इसे अन्य एप्लिकेशन में लाइब्रेरी के रूप में उपयोग कर सकूं।
त्रुटि::
लाइब्रेरी प्रोजेक्ट के build.gradle रूपएंड्रॉइड लाइब्रेरी प्रोजेक्ट के लिए जैकऑप्शन का उपयोग कैसे करें

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' 

} 

मैं एंड्रॉयड स्टूडियो 2.2.1 और JDK 1.8 का उपयोग कर रहा,
JDK 1.8 jackOptions

यह कहते हैं की आवश्यकता है इस प्रकार है लाइब्रेरी परियोजना जैक को सक्षम नहीं कर सकती है। जैक डिफ़ॉल्ट विन्यास में सक्षम है। यदि मैं जैकऑप्शन अक्षम करता हूं तो मेरी लाइब्रेरी जेडीके 1.8 के कारण काम नहीं कर रही है। यह कहता है कि जैकऑप्शन आवश्यक हैं और निम्नलिखित त्रुटियां प्राप्त कर रहे हैं।

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

उत्तर

0

Olivier M. लिए धन्यवाद, आप एक काम कर समाधान का यहाँ हैं: Is there way to use Java 8 features with Android library project?

आयात हिस्सा है:

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

सेटिंग्स में डुप्लिकेट प्रविष्टि। बस अपने build.gradle से निम्नलिखित पंक्तियों को हटा दें:

jackOptions { 
     enabled true 
} 
संबंधित मुद्दे