2015-06-09 142 views
2

我正嘗試構建並運行使用庫的項目。它建立正常,但是當我嘗試運行它,它拋出我這個錯誤: -Android Studio無法運行項目

:testapp:preDexDebug     
warning: Ignoring InnerClasses attribute for an anonymous inner class 
     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80) 
     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61) 
     ... 57 more 
Caused by: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_09\bin\java.exe'' finished with 
non-zero exit value 1 
     at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:42) 
     at com.android.builder.core.AndroidBuilder.preDexLibrary(AndroidBuilder.java:1296) 
     at com.android.builder.internal.compiler.PreDexCache.preDexLibrary(PreDexCache.java:122) 
     at com.android.builder.core.AndroidBuilder.preDexLibrary(AndroidBuilder.java:1248) 
     at com.android.builder.core.AndroidBuilder$preDexLibrary$10.call(Unknown Source) 
     at com.android.build.gradle.tasks.PreDex$PreDexTask.call(PreDex.groovy:150) 
     at com.android.build.gradle.tasks.PreDex$PreDexTask.call(PreDex.groovy) 
     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) 
     at java.util.concurrent.FutureTask.run(FutureTask.java:166) 
     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) 
     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) 
     at java.util.concurrent.FutureTask.run(FutureTask.java:166) 
     ... 3 more 
Caused by: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_09\bin\java.exe'' finished with non-zero exit value 1 
     at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:365) 
     at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:40) 
     ... 14 more 

這是我的完整項目的build.gradle: -

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

buildscript { 
    repositories { 
     jcenter{ 
      url "http://jcenter.bintray.com" 
     } 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:1.2.3' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     mavenLocal() 
     maven{ 
      url "D:/mavenrepository-new" 
     } 
     maven{ 
      url "http://bridge.mindtree.com/nexus/content/repositories/igg-releases/" 
     } 
     jcenter{ 
      url "http://jcenter.bintray.com" 
     } 
    } 
} 

這是的build.gradle我的圖書館: -

apply plugin: 'com.android.library' 

android { 
    compileSdkVersion 22 
    buildToolsVersion "22.0.1" 

    defaultConfig { 
     minSdkVersion 15 
     targetSdkVersion 22 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    dexOptions { 
     preDexLibraries = false 
    } 
    defaultConfig { 
     multiDexEnabled true 
    } 
    lintOptions { 
     abortOnError true 
    } 
    packagingOptions { 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/notice.txt' 
     exclude 'META-INF/license.txt' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/DEPENDENCIES' 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.google.android.gms:play-services:7.5.0' 
    compile 'com.mindtree.bridge.framework:CoreAPI:1.0.0' 
    compile 'com.mindtree.bridge.framework:bridge-account-lib:2.0.0' 
    compile 'com.mindtree.bridge.platform:BRBASE-generated-java-api:2.0.0' 
} 

這是我的應用程序的的build.gradle: -

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 22 
    buildToolsVersion "22.0.1" 

    defaultConfig { 
     applicationId "com.igotgarbage.testapp" 
     minSdkVersion 15 
     targetSdkVersion 22 
     versionCode 1 
     versionName "1.0" 
    } 
    packagingOptions { 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/notice.txt' 
     exclude 'META-INF/license.txt' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/DEPENDENCIES' 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:appcompat-v7:22.2.0' 
    compile project(':app') 
} 

我已經試過乾淨的建立在我的項目和所有相關的答案都建議。但沒有任何幫助。一些正確的答案將非常感激。

+0

你有一個該庫的jar以及gradle導入嗎? –

+0

編號只有gradle導入 – deep

+0

它發生在我身上,因爲內存不足..嘗試釋放更多內存..並再試一次 –

回答

0

如果它不是,因爲我提到的內存問題..試試這個:

文件=>無效緩存/重啓

+0

沒有幫助。沒有效果 – deep

+0

試試這個提示:http://stackoverflow.com/a/29004763/2267723它看起來類似於你的問題... –

3
packagingOptions { 
    exclude 'META-INF/notice.txt' 
    exclude 'META-INF/license.txt' 
    exclude 'META-INF/spring.schemas' 
    exclude 'META-INF/spring.handlers' 
    exclude 'META-INF/spring.tooling' 
    exclude 'META-INF/NOTICE' 
    exclude 'META-INF/LICENSE' 
    exclude 'META-INF/LICENSE.txt' 
    exclude 'META-INF/NOTICE.txt' 
    exclude 'META-INF/DEPENDENCIES' 
    exclude 'META-INF/DEPENDENCIES.txt' 
    exclude 'META-INF/dependencies.txt' 
} 

lintOptions { 
    abortOnError false 
} 

這種排除可能會幫助,如果棉絨產生了一些問題,你可以使用在「lintOptions」代碼之上。還有一件事你需要注意的是,嘗試關閉所有外部應用程序,以便有可用的RAM運行和應用程序。當CPU使用率達到100%時出現此錯誤。