我的應用程序超過64k方法所以iam應該實現Multidex, 最初我有問題,因爲「本地路徑不存在」我修復了這個問題,現在gradle生成classes1.dex和classes2.dex, 但不工作在低於棒棒糖..因爲它有一個本地支持。因爲它有一個本地支持.error說,「< 1st activity>是不存在於dex路徑」Multidex:沒有發現類異常
看到一些教程後,他們說,必須1.gradle 2.application class 3.manifest
我沒有太多關於應用程序類的知識..很好的指導我,謝謝
注意:這是從eclipse導入的項目。
查收的build.gradle文件
apply plugin: 'com.android.application'
android {
defaultConfig {
compileSdkVersion 23
buildToolsVersion '23.0.1'
minSdkVersion 15 //lower than 14 doesn't support multidex
targetSdkVersion 23
}
dexOptions {
jumboMode = true
preDexLibraries = false
javaMaxHeapSize "2048M"
}
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = ['--multi-dex']
} else {
dx.additionalParameters += '--multi-dex'
}
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
productFlavors {
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:multidex:1.0.1'
}
http://pastebin.com/qkSwya4U請訪問這個鏈接..錯誤 –
@rajsharmashanmugam嘗試清理你的項目,然後再次構建。 如果發生相同的構建失敗,「--main-dex-list中的類太多」錯誤意味着您擁有過多的依賴關係。嘗試刪除你不需要的東西。對於最後的手段,檢查我的答案[這裏](http://stackoverflow.com/q/32753991/32781172#32781172)爲類似的問題。 –