2

我一直在使用Android Studio,並在嘗試構建時遇到此錯誤。我無法繼續。Android工作室:Gradle編譯完成,出現錯誤

這是Android Studio中的錯誤:

Executing tasks: [:libraries:facebook:generateDebugSources, :library:generateDebugSources, :volley:generateDebugSources] 

    Configuration on demand is an incubating feature. 
    WARNING [Project: :volley] "testPackageName" is deprecated (and will soon stop working); change to "testApplicationId" instead 
    :libraries:facebook:preBuild 
    :libraries:facebook:preDebugBuild 
    :libraries:facebook:checkDebugManifest 
    :libraries:facebook:prepareDebugDependencies 
    :libraries:facebook:compileDebugAidl UP-TO-DATE 
    :libraries:facebook:compileDebugRenderscript UP-TO-DATE 
    :libraries:facebook:generateDebugBuildConfig UP-TO-DATE 
    :libraries:facebook:generateDebugAssets UP-TO-DATE 
    :libraries:facebook:mergeDebugAssets UP-TO-DATE 
    :libraries:facebook:generateDebugResValues UP-TO-DATE 
    :libraries:facebook:generateDebugResources UP-TO-DATE 
    :libraries:facebook:packageDebugResources UP-TO-DATE 
    :libraries:facebook:processDebugManifest UP-TO-DATE 
    :libraries:facebook:processDebugResources UP-TO-DATE 
    :libraries:facebook:generateDebugSources UP-TO-DATE 
    :library:preBuild 
    :library:preDebugBuild 
    :library:checkDebugManifest 
    :library:prepareDebugDependencies 
    :library:compileDebugAidl UP-TO-DATE 
    :library:compileDebugRenderscript UP-TO-DATE 
    :library:generateDebugBuildConfig UP-TO-DATE 
    :library:generateDebugAssets UP-TO-DATE 
    :library:mergeDebugAssets UP-TO-DATE 
    :library:generateDebugResValues UP-TO-DATE 
    :library:generateDebugResources UP-TO-DATE 
    :library:packageDebugResources UP-TO-DATE 
    :library:processDebugManifest UP-TO-DATE 
    :library:processDebugResources UP-TO-DATE 
    :library:generateDebugSources UP-TO-DATE 
    :volley:preBuild 
    :volley:preDebugBuild 
    :volley:checkDebugManifest 
    :volley:prepareDebugDependencies 
    :volley:compileDebugAidl UP-TO-DATE 
    :volley:compileDebugRenderscript UP-TO-DATE 
    :volley:generateDebugBuildConfig UP-TO-DATE 
    :volley:generateDebugAssets UP-TO-DATE 
    :volley:mergeDebugAssets UP-TO-DATE 
    :volley:generateDebugResValues UP-TO-DATE 
    :volley:generateDebugResources UP-TO-DATE 
    :volley:packageDebugResources UP-TO-DATE 
    :volley:processDebugManifest UP-TO-DATE 
    :volley:processDebugResources UP-TO-DATE 
    :volley:generateDebugSources UP-TO-DATE 

構建失敗

總時間:2分鐘7.494秒

這是我的應用程序的gradle產出:

的build.gradle:

 apply plugin: 'android' 

    android { 
     compileSdkVersion 19 
     buildToolsVersion '19.1.0' 
     defaultConfig { 
      minSdkVersion 11 
      targetSdkVersion 19 
      versionCode 1 
      versionName '1.0' 
     } 
     signingConfigs { 
      release { 

      } 
     } 
     buildTypes { 
      release { 
       signingConfig signingConfigs.release 
      } 
     } 
     packagingOptions { 
      exclude 'META-INF/DEPENDENCIES' 
      exclude 'META-INF/NOTICE' 
      exclude 'META-INF/LICENSE' 
      exclude 'META-INF/LICENSE.txt' 
      exclude 'META-INF/NOTICE.txt' 
      exclude 'META-INF/ASL2.0' 
     } 
     productFlavors { 
     } 
    } 


    dependencies { 
     compile 'com.android.support:support-v4:19.1.0' 
     compile 'com.google.android.gms:play-services:5.0.77' 
     compile 'com.android.support:appcompat-v7:+' 
     compile 'com.makeramen:roundedimageview:1.2.4' 
     compile 'com.nineoldandroids:library:2.4.0+' 
     compile project(':libraries:facebook') 
     compile project(':library') 
     compile project(':stripe') 
     compile project(':volley') 
     compile fileTree(dir: 'libs', include: ['*.jar']) 
     compile files('libs/activation.jar') 
     compile files('libs/mail.jar') 
     compile files('libs/iprint.jar') 
    } 
+0

查看http://stackoverflow.com/questions/21717885/cannot-run-project-in-android-studio – matiash

回答

0

我今天面臨同樣的問題

這是dex合併中的錯誤,當合並的dex文件有超過65536個方法(或字符串)時。我們可以通過添加

dexOptions { jumboMode =真 }

在gradle這個文件解決此問題。不要忘記添加這個所有子項目,否則它可能無法正常工作。

+0

謝謝,但我已經在我的問題上做了一些更正 – sherin

1

我不確定你是否發佈了所有錯誤的文本,在我的情況下最終會是非常有用的信息來解決這個問題。也許在你的情況下,麻煩是一樣的。

因此,在我的情況是與依賴問題。 在我的應用程序模塊中build.grale我用其他依賴於support.v4

你的情況:編譯 'com.android.support:support-v4:19.1.0'

的Facebook SDK使用罐子,所以,support.v4被添加爲罐子。

爲了解決這個問題,只是刪除罐子,並添加到您的的Facebook的build.gradle文件的同一行導入支持庫作爲主應用程序模塊。

希望,這會幫助你。

0

我在Ubuntu 16.04面對這個問題,用一個簡單的解決方案提出了:

在終端類型sudo nautilus

現在轉到根目錄並遞歸地將權限更改爲讀取和寫入以及創建和刪除文件。您可以通過選擇更改封閉文件的權限來執行此操作。

1

這個問題很老,但它可能對Android Studio的新程序員有用, 所以這個錯誤在我的情況下通過從Build菜單清理項目解決。

相關問題