development

com.android.build.transform.api.TransformException

big-blog 2020. 6. 3. 08:06
반응형

com.android.build.transform.api.TransformException


내 앱에서 Google 로그인을 통합하려고합니다.이 라이브러리를 추가했습니다.

compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-plus:8.1.0'

또한 이것을 빌드 빌드 gradle에 추가하십시오.

classpath 'com.google.gms:google-services:1.4.0-beta3'

또한 앱 빌드 gradle에 플러그인을 추가하십시오.

apply plugin: 'com.google.gms.google-services'

그런 다음 필요한 권한을 추가하지만 앱을 실행하려고하면이 오류가 발생했습니다.

    Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
    com.android.build.transform.api.TransformException: com.android.ide.common.process.ProcessException: 
    org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0\bin\java.exe'' finished with non-zero exit value 2

multiDexEnabled trueapp build.gradle 파일에 추가 하십시오.

 defaultConfig {
    multiDexEnabled true
}

편집하다:

스티브의 대답을 먼저 시도하십시오 . 자주 발생하거나 첫 번째 단계가 도움 multiDexEnabled되지 않은 경우 . 더 깊이 파고 싶어하는 사람들에게는 몇 가지 비슷한 문제가 있습니다 (더 많은 답변이 있음).

: app : dexDebug ExecException이 0이 아닌 종료 값 2로 완료되었습니다.

오류 : ': app : dexDebug'작업에 대한 실행이 실패했습니다. com.android.ide.common.process.ProcessException


주의해야 할 또 다른 것은

compile 'com.google.android.gms:play-services:8.3.0'

모든 플레이 서비스를 가져 오며, 단일 덱스 APK의 65535 방법 제한을 초과하는 데는 Hello World가 필요합니다.

필요한 서비스 만 항상 지정하십시오 (예 :

compile 'com.google.android.gms:play-services-identity:8.3.0'
compile 'com.google.android.gms:play-services-plus:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'

방금 프로젝트를 정리 한 후 성공적으로 빌드했습니다.


이 오류는 프로젝트에 새로운 방법을 추가했을 때 나타납니다. 나는 65k 메소드 한계에 가깝다는 것을 알았고 프로젝트를 도울 수 있다면 multiDex 지원을 사용하고 싶지 않았습니다.

:app:transformClassesForDexForDebug작업에 사용 가능한 메모리를 늘려서 해결했습니다 . javaMaxHeapSize지정 하여이 작업을 수행 했습니다 gradle.build.

gradle.build

android {
    ...
    dexOptions {
        javaMaxHeapSize "4g" //specify the heap size for the dex process
    }
}

이 문제에 대한 다른 일반적인 해결책으로 성공하지 못한 후에 이것을 시도했습니다.

  • 프로젝트 실행 clean
  • 프로젝트에서 /app/build/build디렉토리를 수동으로 삭제
  • Gradle Cache 무효화 및 Android Studio 재시작

오류

오류 : 태스크> ': app : transformClassesWithDexForDebug'에 대한 실행이 실패했습니다. com.android.build.api.transform.TransformException : com.android.ide.common.process.ProcessException : org.gradle.process.internal.ExecException : Process 'command'/Library/Java/JavaVirtualMachines/jdk1.8.0_45. jdk / Contents / Home / bin / java ''가 0이 아닌 종료 값 1로 완료되었습니다.

참고 : DEX 작업에 사용 가능한 메모리를 늘리면 메모리 링크 가 낮은 시스템에서 성능 문제가 발생할 수 있습니다 .


또한 Android Studio 1.5.1 및 gradle 1.5.0에서 비슷한 문제에 직면했습니다. 내 앱의 build.gradle 파일에 자동으로 추가 될 수있는 종속성에서 원하지 않는 라이브러리를 제거해야합니다. 하나는 'com.google.android.gms : play-services : 8.4.0'입니다. 따라서 모범 사례의 경우 광고 포함과 같은 특정 재생 서비스 라이브러리 만 포함 시키십시오.

dependencies {
    compile 'com.google.android.gms:play-services-ads:8.4.0'
}

이기는 하지만

defaultConfig {
    multiDexEnabled true
}

이것은 또한 문제를 해결하지만 gradle 콘솔에 많은 메모를 제공하므로 빌드 중에 다른 실제 문제를 찾는 것이 혼란 스럽습니다.


당신은 안드로이드 의 문서를 볼 수 있습니다

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.0"

    defaultConfig {
        ...
        minSdkVersion 14
        targetSdkVersion 21
        ...

        // Enabling multidex support.
        multiDexEnabled true
    }
    ...
}

dependencies {
  compile 'com.android.support:multidex:1.0.0'
}

Manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android.multidex.myapplication">
    <application
        ...
        android:name="android.support.multidex.MultiDexApplication">
        ...
    </application>
</manifest>

AS 1.5.1을 사용하고 있으며 동일한 문제가 발생했습니다. 그러나 프로젝트를 청소하는 것만으로는 효과가 없으므로 무언가를 시도했습니다.

  • 깨끗한 프로젝트
  • AS를 다시 시작
  • 프로젝트 동기화

이것은 나와 함께 일했기 때문에 이것이 도움이되기를 바랍니다.


필자의 경우 buildToolsVersion을 "24"에서 "23.0.2"로 변경하고 문제를 해결하십시오.


제 경우에는 모든 Google Play 서비스 확장 프로그램이 다음과 같은 버전이 아니기 때문에 예외가 발생했습니다.

 compile 'com.google.android.gms:play-services-plus:9.8.0'
 compile 'com.google.android.gms:play-services-appinvite:9.8.0'
 compile 'com.google.android.gms:play-services-analytics:8.3.0'

이것을 이것을 바꿀 때 효과가있었습니다.

compile 'com.google.android.gms:play-services-plus:9.8.0'
 compile 'com.google.android.gms:play-services-appinvite:9.8.0'
 compile 'com.google.android.gms:play-services-analytics:9.8.0'

다음으로 해결했습니다.

멀티 덱스를 구성 했습니다

build.gradle에서 다음 파일을 추가해야합니다.

android {
...
   defaultConfig {
       ...
       // Enabling multidex support.
       multiDexEnabled true
       ...
   }
   dexOptions {
      incremental true
      maxProcessCount 4 // this is the default value
      javaMaxHeapSize "2g"
   }
...
}
dependencies {
...
   compile 'com.android.support:multidex:1.0.1'
...
}

local.properties에 다음을 추가하십시오.

org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

그런 다음 Application 클래스에 Multidex도 추가해야합니다.

 public class MyApplication extends MultiDexApplication {

   @Override
   public void onCreate() {
       super.onCreate();
       //mas codigo
   }

   @Override
   protected void attachBaseContext(Context base) {
       super.attachBaseContext(base);
       MultiDex.install(this);
   }
}

Manifest.xml에 라인 코드를 추가하는 것을 잊지 마십시오

<application
    ...
    android:name=".MyApplication"
    ...
/>

이것으로 버그를 해결하기에 충분합니다. 태스크 ': app : transformClassesWithDexForDebug에 대한 실행이 실패했습니다. javaMaxHeapSize "2g"를 사용하여 build.gradle을 확인하십시오. local.properties org.gradle.jvmargs = -Xmx2048m은 2 기가 바이트입니다.


I had same problem when i rolled back to old version via git, and that version had previous .jar library of one 3rd party api, and for some reason turned out that both jar of the same sdk, just different versions were in /libs folder.


First Delete intermediates files YOUR APP FOLDER\app\build\intermediates OR Clean your project and then rebuild.

Thent add

multiDexEnabled true

i.e.

defaultConfig {
        multiDexEnabled true
}

It's work for me


I solved this issue by change to use latest buildToolsVersion

android {
    //...
    buildToolsVersion '26.0.2' // change from '23.0.2'
    //...
}

If you are using the latest gradle version ie classpath 'com.android.tools.build:gradle:1.5.0' and classpath 'com.google.gms:google-services:1.4.0-beta3', then try updating the latest support respository from the SDK manager and rebuild the entire project.


If you need add this reference for cordova plugin add next line in your plugin.xml file.

<framework src="com.android.support:support-v4:+" />

If the different dependencies have a same jar also cause this build error.

For example:

compile('com.a.b:library1');
compile('com.c.d:library2');

If "library1" and "library2" has a same jar named xxx.jar, this will make such an error.


It happened to me because of Eclipse memory leak. I had to restart my computer.


I changed a couple of pngs and the build number in the gradle and now I get this. No amount of cleaning and restarting helped. Disabling Instant Run fixed it for me. YMMV


I had the same option and as soon as I turned off Instant run, it worked fine on my API16 device, but on the API24 device it worked fine with Instant run.

Hope this helps someone having the same issue


Simply go to Build - Edit Build Types - Properties Tab - Build Type Version and downgrade it to ver 23.0.1. Click ok. This works for android studio 1.5. It worked for me.


the write answer is in gradle put defaultConfig { multiDexEnabled true } then application name in manifest android:name="android.support.multidex.MultiDexApplication" wish this answer is hellpful to some one


this code solved problem

defaultConfig {
        multiDexEnabled true
}

For easiest way to implement google sign in visit: google sign in android

Also try

dexOptions {
        javaMaxHeapSize "4g" 
    }

Also keep same version number for different services.


I solved this issue by adding: In build.gradle:

defaultConfig {
    multiDexEnabled true
}

in local.properties ,

org.gradle.jvmargs=-XX\:MaxHeapSize\=512m -Xmx512m

mention dependency:

compile 'com.android.support:multidex:1.0.1'

Clean and Rebuild.


Incase 'Instant Run' is enable, then just disable it.

참고URL : https://stackoverflow.com/questions/32807587/com-android-build-transform-api-transformexception

반응형