android - AAPT2 错误 : check logs for details(Build failed)

标签 android gradle build

我刚刚回到我的旧项目,因为我一直没有在它上工作,我发现很多错误作为 gradle 中的构建错误,因为我使用编译而不是实现和我试图解决的许多其他过程这个错误很多但我失败了as this my window error那是我无法识别的,因为我还使用了 github 中的旧库

这是 myGradle (build.gradle(Project:Waiterer))

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

这是 build.gradle(Module:app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "abtech.waiteriano.com.waitrer"
        minSdkVersion 18
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation project(':jtds-1.3.1')
    implementation project(':library')
    implementation project(':librarySV')
    implementation 'com.android.support:support-v4:25.2.0'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:25.3.1'
    implementation 'com.roughike:bottom-bar:1.3.9'
    implementation 'com.android.support:recyclerview-v7:25.2.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
    implementation 'com.github.clans:fab:1.6.2'
    implementation 'de.hdodenhof:circleimageview:1.3.0'
    implementation 'com.android.support:cardview-v7:25.3.1'
    testImplementation 'junit:junit:4.12'
    implementation "com.android.support:gridlayout-v7:23.1.1"
}

这是我使用的第一个 gradle 库 build.gradle(模块:库)

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion '27.0.3'

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:23.1.1'
}

这是我使用的第二个图书馆 build.gradle(模块:librarySV)

apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.novoda:bintray-release:0.8.1'
    }
}

android {
    compileSdkVersion 23
    buildToolsVersion '25.0.0'

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.4.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:23.1.1'
    implementation 'com.android.support:design:23.1.1'
}

publish {
    userOrg = 'miguelcatalan'
    groupId = 'com.miguelcatalan'
    artifactId = 'materialsearchview'
    publishVersion = '1.4.0'
    desc = 'Cute library to implement SearchView in a Material Design Approach'
    website = 'https://github.com/MiguelCatalan/MaterialSearchView'
}

希望这能足够清楚如果有什么不清楚的告诉我 请注意:我没有使用 API 我使用 JDBC JTDS 连接从数据库中检索数据

最佳答案

问题是开发人员仍然对新 AS 感到不舒服。显示错误的方式已更改(现在很奇怪)。

首先 在构建错误中向下滚动。如果您看到错误,请单击以将其展开。它很可能会向您显示错误。

enter image description here

其次如果这不起作用(就像我在数据绑定(bind)中遇到的那样,没有显示任何错误)

然后尝试使用调试或堆栈跟踪进行构建

转到

File > Settings > Build, Execution, Deployment > Compiler

像这样添加(添加--stacktrace--debug),它会记录异常。您可以查看导致问题的原因。

screenshot

关于android - AAPT2 错误 : check logs for details(Build failed),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50157912/

相关文章:

java - 在 pom.xml 的 lib 文件夹中添加类路径和依赖项后,Maven 构建失败 NoClassDefFoundError

c# - 编译器构建错误 : The call is ambiguous between the following methods or properties

java - getSystemService(Context.Location_SERVICE) 导致 java.lang.NullPointerException

android - notifyDataSetChanged() 不刷新可扩展 ListView

android - 在 Android 上通过 bash 脚本启用/禁用 wifi

java - Java 10 中的 Gradle javadoc 任务失败

android - 在 Android 中关闭搜索对话框的功能是什么?

android - 将Eclipse制作的Android项目从Github导入并转换为Android Studio Gradle-build

android - 如何在 Android 库项目中进行调试?

gradle - 使用Gradle 2.6构建Play Framework 2.4应用程序失败