相关疑难解决方法(0)

程序类型已存在:BuildConfig

我正在尝试生成发布版本但由于mutidex问题而无法使用我的项目已启用所有multidex并添加了依赖项

我收到的错误是:

Execution failed for task ':app:transformClassesWithMultidexlistForRelease

Caused by: com.android.build.api.transform.TransformException: Error while generating the main dex list.
Run Code Online (Sandbox Code Playgroud)

和aslo:

Caused by: com.android.tools.r8.errors.CompilationError: Program type already present: com.myapp.BuildConfig
Run Code Online (Sandbox Code Playgroud)

android android-multidex

37
推荐指数
5
解决办法
2万
查看次数

什么是Android Pre-Dexing以及如何提高性能?

我看到Android的蚂蚁脚本有消息说它是"预先dexing".然而,dex和pre-dex使用相同的选项,除了在一种情况下一次一个罐子,在其他情况下一次多个罐子.

真正需要的是什么?pre-dex是强制性的吗?

例如

The ' characters around the executable and arguments are
not part of the command.
      [dex] Pre-Dexing F:\users\tejasoft\work\fnd\cmn\tools\social\sz\demo\libs\pinit-sdk-1.0.jar -> pinit-sdk-1.0-e3bebafa2727504605edf3d8d85b5d46.jar
       [dx] Current OS is Windows 7
       [dx] Executing 'D:\Apps\java\embd\cmn\android\oems\google\adt\4.x\4.3.x\4.3\sdk\build-tools\18.1.0\dx.bat' with arguments:
       [dx] '--dex'
       [dx] '--output'
       [dx] 'F:\users\tejasoft\work\fnd\cmn\tools\social\sz\demo\bin\dexedLibs\pinit-sdk-1.0-e3bebafa2727504605edf3d8d85b5d46.jar'
       [dx] 'F:\users\tejasoft\work\fnd\cmn\tools\social\sz\demo\libs\pinit-sdk-1.0.jar'
       [dx] 
       [dx] The ' characters around the executable and arguments are
       [dx] not part of the command.
Execute:Java13CommandLauncher: Executing 'D:\Apps\java\embd\cmn\android\oems\google\adt\4.x\4.3.x\4.3\sdk\build-tools\18.1.0\dx.bat' with arguments:
'--dex'
'--output'
'F:\users\tejasoft\work\fnd\cmn\tools\social\sz\demo\bin\dexedLibs\pinit-sdk-1.0-e3bebafa2727504605edf3d8d85b5d46.jar'
'F:\users\tejasoft\work\fnd\cmn\tools\social\sz\demo\libs\pinit-sdk-1.0.jar'

The ' characters around the executable and arguments are
not part of the …
Run Code Online (Sandbox Code Playgroud)

android dex

24
推荐指数
1
解决办法
1万
查看次数

程序类型已存在:android.support.constraint.BuildConfig

build.gradle(模块:app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 'android-P'
    buildToolsVersion '27.0.3'
    defaultConfig {
        multiDexEnabled true
        applicationId "tk.megh.myapplication"
        minSdkVersion 'P'
        targetSdkVersion 'P'
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        preDexLibraries = false
    }
}



dependencies {
    implementation 'com.android.support:multidex:1.0.1'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.0'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:+'
    testImplementation 'junit:junit:4.12'

}
Run Code Online (Sandbox Code Playgroud)

嗯,我想我知道是什么导致了错误,如果你看一下依赖关系,有两个不同名称的冗余包

com.android.support.constraint:constraint-layout:1.1.0 androidx.constraintlayout:constraintlayout:1.1.0

但我不能删除其中任何一个,因为它们被某些包使用.我是Android开发的新手,所以我对任何变通方法都不太了解.

如果我删除

implementation 'com.android.support.constraint:constraint-layout:1.1.0'
Run Code Online (Sandbox Code Playgroud)

调试时出现此错误:

    java.lang.RuntimeException: …
Run Code Online (Sandbox Code Playgroud)

android gradle android-studio build.gradle

12
推荐指数
1
解决办法
7803
查看次数

程序类型已经存在:com.unity3d.player.BuildConfig

我正在尝试将Unity项目集成到已经存在的Android Studio项目中。当我尝试运行该应用程序时出现此错误:

程序类型已经存在:com.unity3d.player.BuildConfig

android unity-game-engine vuforia

5
推荐指数
2
解决办法
6813
查看次数