【问题标题】:Android project there is no output dir after gradle build success?Android项目gradle构建成功后没有输出目录?
【发布时间】:2016-11-29 09:21:09
【问题描述】:

我最近在学习 Gradle for Android。为了让学习印象深刻,我手动创建了所有 android 应用程序文件。

我的项目目录如下

  • 包名:com.wonbin.gradledemo

  • 项目 build.gradle

    buildscript {
    
            repositories {
                    jcenter()
            }
    
            dependencies {
                    classpath 'com.android.tools.build:gradle:2.2.2'
            }
    }
    allprojects {
            repositories {
                    jcenter()
            }
    }
    
  • 应用模块 build.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 build 成功,有'intermediates'和'generated' dirs ,但没有输出目录,我不知道该怎么办!

非常感谢!

【问题讨论】:

  • 任何需要的信息请评论
  • 在应用程序模块中(MyApp/app/build)。有输出/apk/app-debug.apk。我很抱歉。请关闭它,谢谢

标签: android gradle


【解决方案1】:

您不仅需要构建它,还需要组装它。
为此,您可以运行 gradle 任务

assembleDebug

或者使用Build -> Build APK主菜单项

【讨论】:

  • 感谢您的回答。问题解决了 ! gradle 生成了两个名为“build”的目录。一个在根目录(MyApp/build);另一个在应用模块(MyApp/app/build)中。
  • 感谢您的回答。问题解决了 ! gradle 生成了两个名为“build”的目录。一个在根目录(MyApp/build);另一个在应用程序模块(MyApp/app/build)中。有输出/apk/app-debug.apk。顺便说一句:构建任务包括组装和检查。 assemble 任务包括 assembleDebug 和 assembleRelease 谢谢
  • 也许使用“依赖”而不是“包含”更好
  • @wonbin2011,如果答案正确,请标记为correct。
  • @Ahmad 是正确的。如果您认为它不正确 - 请提供一些证据。
猜你喜欢
  • 2017-12-03
  • 1970-01-01
  • 2013-06-03
  • 2017-06-24
  • 2016-02-25
  • 1970-01-01
  • 2012-08-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多