java - android studio 测试应用程序无法打开

标签 java android gradle

  1. 事件日志只是提醒我该消息:

    Executing tasks: [:app:assembleDebug]

    Gradle build finished in 1s 45ms

我认为这是我的 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
            }

最佳答案

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
}
`

关于java - android studio 测试应用程序无法打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50132131/

相关文章:

android 解析服务器 gradle 同步失败

java - 如何从本地存储库覆盖现有的 Gradle 插件?

java - Mockito 超时验证在并发执行时意外失败

java - 如何克隆对象以移动某些内容并查看移动是否有效? ( java 、国际象棋)

用于任意字符串的 Android 选择器小部件

android - 了解对象是否订阅了事件总线或 Otto 库中的事件

java.util.concurrent.ExecutionException : org. apache.catalina.LifecycleException: 启动失败

java - PMD规则 "Use Proper Class Loader"解释?

android - Api Key 将我的应用与 Google map 一起发布到 Google Play

android-studio - Android Studio 与 Gradle 中的差异构建项目