【问题标题】:Android Studio Error while generating the main dex list生成主 dex 列表时出现 Android Studio 错误
【发布时间】:2018-12-07 10:36:06
【问题描述】:

我是 android 应用程序开发的新手,但我正在构建一个 AR 应用程序,该应用程序还使用 glide 从网站中选择一件艺术品,然后使用 AR 挂在墙上。

我得到“生成主 dex 列表时出错”,我不知道为什么。

我已经构建了主应用程序,然后从维基百科导入了 AR 部分,所以我想知道这是否会造成冲突。

我不确定向您展示的最佳方式是否是将项目上传到某个地方,然后让别人浏览它?

提前致谢

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
    applicationId "codingwithmitch.com.recyclerview"
    minSdkVersion 19
    targetSdkVersion 27
    multiDexEnabled true
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    dexOptions {
        javaMaxHeapSize "4g"
    }

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



dependencies {

implementation (name: 'wikitudesdk', ext:'aar' )
implementation project(':arapp')
    implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
//recyclerview
implementation 'com.android.support:recyclerview-v7:27.1.0'
//glide
implementation 'com.github.bumptech.glide:glide:4.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
//circle imageview
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'androidx.multidex:multidex:2.0.0'



}

这是增强现实部分

apply plugin: 'com.android.library'

android {
compileSdkVersion 27
buildToolsVersion '28.0.3'

defaultConfig {

    minSdkVersion 19
    targetSdkVersion 27
    multiDexEnabled true
    versionCode 1
    versionName "8.0.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
}
}

dependencies {
 testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation(name: 'wikitudesdk', ext: 'aar')
implementation 'com.google.ar:core:1.1.0'


}

repositories {
flatDir{
    dirs 'libs'
}
}

【问题讨论】:

  • 你能分享你的 build.gradle 文件吗?我猜是依赖不匹配。
  • 查看已编辑的问题。希望这会有所帮助。我实际上将一个 aar 文件导入了我的应用程序,所以它看起来像有 2 个 build.gradles。上一个是主应用,第二个是 AR 部分

标签: android augmented-reality android-glide wikitude


【解决方案1】:

也许你可以试试这个,我不确定它是否会起作用:

//In your app gradle file, inside "android":

dexOptions {
        javaMaxHeapSize "4g"
    }

//Also in your app gradle file, inside "dependencies":
implementation 'androidx.multidex:multidex:2.0.0'

【讨论】:

  • 嘿,不幸的是,当我尝试构建 apk 时,我仍然得到同样的东西。有什么我可以发给你看的。
  • 也许你可以发布你构建应用程序的gradle
猜你喜欢
  • 1970-01-01
  • 2019-04-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-05-01
  • 2021-08-03
  • 1970-01-01
相关资源
最近更新 更多