2016-11-29 122 views
1

我最近在學習Android的Gradle。爲了讓人印象深刻,我手動創建了所有的android應用程序文件。Android項目Gradle構建成功後沒有輸出目錄嗎?

我的項目迪爾斯如下

  • 包名稱:com.wonbin.gradledemo

  • 項目的build.gradle

    buildscript { 
    
         repositories { 
           jcenter() 
         } 
    
         dependencies { 
           classpath 'com.android.tools.build:gradle:2.2.2' 
         } 
    } 
    allprojects { 
         repositories { 
           jcenter() 
         } 
    } 
    
  • 應用模塊裝配。 gradle:

    apply plugin: 'com.android.application' 
    
    android { 
    
         compileSdkVersion 23 
         buildToolsVersion "24.0.2" 
         defaultConfig { 
           applicationId "com.wonbin.gradledemo" 
           minSdkVersion 15 
           targetSdkVersion 23 
           versionCode 1 
           versionName "1.0" 
           testInstrumentationRunner "adroid.support.test.runner.AndroidJUnitRunner" 
         } 
         buildTypes { 
           debug { 
           } 
           release { 
             minifyEnabled false 
             proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro' 
           } 
         } 
         lintOptions { 
          htmlReport true 
          htmlOutput file("lint-results.html") 
         } 
    } 
    
    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:appcompat-v7:23.4.0' 
          testCompile 'junit:junit:4.12' 
        } 
    

./gradlew構建成功,並有「中間」和「產生」 迪爾斯,但沒有輸出目錄,我不知道該怎麼辦!

非常感謝!

+0

請評論 – wonbin2011

+0

在應用模塊(MyApp的/應用/編譯)所需的任何信息。有輸出/ apk/app-debug.apk。 我很抱歉。請關閉它,謝謝 – wonbin2011

回答

0

您不僅需要構建,還需要進行組裝。
要做到這一點,你可以運行gradle這個任務

assembleDebug 

或者使用Build - >Build APK主菜單項目

+0

感謝您的回答。問題解決了 ! Gradle生成了兩個名爲「build」的dir。一個在根目錄下(MyApp/build);另一個是在應用程序模塊(MyApp/app/build)中。 – wonbin2011

+0

感謝您的回答。問題解決了 ! Gradle生成了兩個名爲「build」的dir。一個在根目錄下(MyApp/build);另一個是在應用程序模塊(MyApp/app/build)中。 有輸出/ apk/app-debug.apk。 BTW:構建任務包括彙編和檢查。組裝任務包括assembleDebug和assembleRelease 謝謝 – wonbin2011

+0

也許使用「依賴」而不是「包含」更好 – wonbin2011

相關問題