您好我正在尝试从我的项目中的这个github导入CameraKit:
https://github.com/wonderkiln/CameraKit-Android
然后我在添加这个库后编译我的应用程序我按下Sync gradle并且Android Studio Logcat中没有显示错误,但如果我尝试运行它我的模拟器,我会收到此错误:
AGPBI: {"kind":"error","text":"Dex writing phase: classes.dex has too many IDs. Try using multi-dex","sources":[{}]}
:app:transformJackWithJackForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformJackWithJackForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.core.JackToolchain$ToolchainException: Jack compilation exception
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 5 mins 15.228 secs
Error:Dex writing phase: classes.dex has too many IDs. Try using multi-dex
Error:Execution failed for task ':app:transformJackWithJackForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.core.JackToolchain$ToolchainException: Jack compilation exception
My App gradle看起来像这样:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.jacklas.fitnessm8"
minSdkVersion 19
targetSdkVersion 25
versionCode 100131
versionName "1.0A(131)"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
}
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dexOptions {
javaMaxHeapSize '4096m'
}
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'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v13:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.google.firebase:firebase-core:9.8.0'
compile 'com.google.firebase:firebase-messaging:9.8.0'
compile 'com.google.firebase:firebase-ads:9.8.0'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
testCompile 'junit:junit:4.12'
compile 'com.wonderkiln:camerakit:0.11.0'
// retrofit, gson, jxjava
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.2'
compile 'io.reactivex.rxjava2:rxjava:2.1.2'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
compile 'com.afollestad.material-dialogs:core:0.9.3.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'jp.wasabeef:picasso-transformations:2.1.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'uk.co.chrisjenx:calligraphy:2.3.0'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.github.nirhart:parallaxscroll:1.0'
compile 'com.jakewharton:butterknife:8.6.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
compile 'br.com.liveo:navigationdrawer-material:2.5.1'
compile 'com.github.nirhart:parallaxscroll:1.0'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'me.zhanghai.android.materialratingbar:library:1.0.2'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
所以我的问题是如何修复它而不使用“multiDexEnabled true”我可以将github导入到我的项目中,因此它不必编译它吗?:
编译'com.wonderkiln:camerakit:0.11.0'