【问题标题】:android studio test app can't openandroid studio测试应用无法打开
【发布时间】:2018-05-03 20:08:10
【问题描述】:
  1. 事件日志只是提醒我该消息:

    执行任务:[:app:assembleDebug]

    Gradle 构建在 1 秒 45 毫秒内完成

我认为这是我的 gradle 设置有问题,但我无法解决。这是我的 build.gradle 的

context:

        apply plugin: 'com.android.application'
        apply plugin: 'kotlin-android'
        apply plugin: 'kotlin-android-extensions'

        android {
            compileSdkVersion 27
            buildToolsVersion '27.0.3'
            aaptOptions.cruncherEnabled = false
            aaptOptions.useNewCruncher = false
        defaultConfig {
            applicationId "skill573.myapplication"
            minSdkVersion 26
            targetSdkVersion 27
            versionCode 1
            versionName "1.0"                                      
            testInstrumentationRunner
            "android.support.test.runner.AndroidJUnitRunner"
            }
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

        dependencies {
            implementation fileTree(include: ['*.jar'], dir: 'libs')
            implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
            implementation 'com.android.support:appcompat-v7:27.1.1'
            implementation 'com.android.support.constraint:constraint-layout:1.1.0'
            testImplementation 'junit:junit:4.12'
            androidTestImplementation 'com.android.support.test:runner:1.0.2'
            androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
        }

和顶级gradle代码:

            buildscript {
                ext.kotlin_version = '1.2.30'
                repositories {
                    google()
                    jcenter()
                }
                dependencies {
                    classpath 'com.android.tools.build:gradle:3.1.2'
                    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
                }
            }
            allprojects {
                repositories {
                    google()
                    jcenter()
                }
            }
            task clean(type: Delete) {
                delete rootProject.buildDir
            }

【问题讨论】:

  • 现在我只是重写 app/gradle 但是,事件日志只是说:执行任务:[:app:assembleDebug]

标签: java android gradle


【解决方案1】:
match according to this files hope its work fine. 

 1.  build.gradel

    `apply plugin: 'com.android.application'
android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "test.com.test"
        minSdkVersion 23
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
`

 2. Top-level build file
  ` buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2' 
    }
}
allprojects {
    repositories {
        google()
        jcenter()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}
`

【讨论】:

  • 第一个能够:谢谢你回答我的愚蠢问题。但这并不能解决我的情况。这甚至使我的问题变得更糟。不过还是谢谢你。
  • 请在此处上传顶级构建文件可能是您与顶级构建文件和gradel依赖项有冲突。
  • 我已经重新编码了所有 gradle 代码。但是仍然有执行任务:[:app:assembleDebug]。
  • 我建立了一个新项目我仍然遇到同样的问题我不知道发生了什么。
  • 我明白了!知道了 !!!!!我很抱歉浪费你的时间。问题不在于 gradle 设置。
猜你喜欢
  • 2018-09-11
  • 1970-01-01
  • 2018-08-06
  • 1970-01-01
  • 2013-12-16
  • 1970-01-01
  • 1970-01-01
  • 2015-09-17
相关资源
最近更新 更多