2016-11-30 115 views
0

這裏是我的graddle:Android的工作室 - transformClassesWithDexForDebug錯誤

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.0" 
    defaultConfig { 
     applicationId "com.xxx.yyy" 
     minSdkVersion 16 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
     multiDexEnabled true 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    packagingOptions { 
     exclude 'META-INF/DEPENDENCIES.txt' 
     exclude 'META-INF/LICENSE.txt' 
     exclude 'META-INF/NOTICE.txt' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/DEPENDENCIES' 
     exclude 'META-INF/notice.txt' 
     exclude 'META-INF/license.txt' 
     exclude 'META-INF/dependencies.txt' 
     exclude 'META-INF/LGPL2.1' 
     exclude 'META-INF/INDEX.LIST' 
    } 
    dexOptions { 
     incremental true 
     javaMaxHeapSize "4g" 
     preDexLibraries = false 
    } 
} 
repositories { 
    maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' } 
} 
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:multidex:1.0.0' 
    //Support Library 
    compile 'com.android.support:appcompat-v7:25.0.1' 
    compile 'com.android.support:design:25.0.1' 
    //Test 
    androidTestCompile 'com.google.code.findbugs:jsr305:3.0.0' 
    testCompile 'junit:junit:4.12' 
    //Google Play Services 
    compile 'com.google.android.gms:play-services-appindexing:8.4.0' 
    //Common Langs 3 
    compile 'org.apache.commons:commons-lang3:3.5' 
    //Google Cloud Translate 
    compile ('com.google.cloud:google-cloud-translate:0.7.0'){ 
     exclude group: 'org.apache.httpcomponents', module: 'httpclient' 
     exclude group: 'org.json', module: 'json' 
    } 
    //Ksoap 2 
    compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.2' 
    //Gson (Shared Preferences) 
    compile 'com.google.code.gson:gson:2.7' 
    //Loading Animation 
    compile 'com.pnikosis:materialish-progress:1.7' 
    //Snackbar 
    compile 'com.androidadvance:topsnackbar:1.1.1' 
    //SVG Animation 
    compile 'com.jaredrummler:animated-svg-view:1.0.0' 
} 

這裏是Androidmanifest.xmlpart

<application 
     android:name="android.support.multidex.MultiDexApplication" 
     android:allowBackup="true" 
     android:configChanges="orientation" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:screenOrientation="portrait" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme"> 
     <activity 
      android:name=".SplashAnimationActivity" 

下面是Android工作室錯誤:

Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:assembleDebug] 
Warning:The `android.dexOptions.incremental` property is deprecated and it has no effect on the build process. 
Error:trouble processing "javax/transaction/HeuristicCommitException.class": 
Error:Ill-advised or mistaken usage of a core class (java.* or javax.*) 
Error:when not building a core library. 
Error:This is often due to inadvertently including a core library file 
Error:in your application's project, when using an IDE (such as 
Error:Eclipse). If you are sure you're not intentionally defining a 
Error:core class, then this is the most likely explanation of what's 
Error:going on. 
Error:However, you might actually be trying to define a class in a core 
Error:namespace, the source of which you may have taken, for example, 
Error:from a non-Android virtual machine project. This will most 
Error:assuredly not work. At a minimum, it jeopardizes the 
Error:compatibility of your app with future versions of the platform. 
Error:It is also often of questionable legality. 
Error:If you really intend to build a core library -- which is only 
Error:appropriate as part of creating a full virtual machine 
Error:distribution, as opposed to compiling an application -- then use 
Error:the "--core-library" option to suppress this error message. 
Error:If you go ahead and use "--core-library" but are in fact 
Error:building an application, then be forewarned that your application 
Error:will still fail to build or run, at some point. Please be 
Error:prepared for angry customers who find, for example, that your 
Error:application ceases to function once they upgrade their operating 
Error:system. You will be to blame for this problem. 
Error:If you are legitimately using some code that happens to be in a 
Error:core package, then the easiest safe alternative you have is to 
Error:repackage that code. That is, move the classes in question into 
Error:your own package namespace. This means that they will never be in 
Error:conflict with core system classes. JarJar is a tool that may help 
Error:you in this endeavor. If you find that you cannot do this, then 
Error:that is an indication that the path you are on will ultimately 
Error:lead to pain, suffering, grief, and lamentation. 
Error:1 error; aborting 
Error:Execution failed for task ':app:transformClassesWithDexForDebug'. 
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException 
Information:Total time: 46.622 secs 
Information:34 errors 
Information:1 warning 
Information:See complete output in console 

我的工作在谷歌雲翻譯應用程序。 我收到錯誤。

我搜索和我有嘗試一些解決方案,但並不能幫助我。

問題是什麼?

我的libs文件夾是空的。

請幫幫我。

+0

你是否初始化multidex? –

+0

檢出:http://stackoverflow.com/questions/37497882/errorexecution-failed-for-task-apptransformclasseswithdexfordebug-in-androi/37498940#37498940 – Ironman

回答

1

我有同樣的問題。在我的應用程序中,我正在使用番石榴重試庫,它正在獲取谷歌番石榴庫版本21. 番石榴版本21需要JDK 1.8而不提供後端移植支持,這在我的情況下導致了這個錯誤。

我能夠通過包括番石榴重試庫,以便它使用番石榴庫19.0版本來解決這個問題:

compile ("com.github.rholder:guava-retrying:2.0.0") { 
    exclude group: 'com.google.guava', module: 'guava' 
} 
compile 'com.google.guava:guava:19.0' 

基本上你想檢查是否有您的應用程序的依賴關係的要求JDK 1.8〜編譯和刪除/降級它們。