Aapt2错误:使用ormlite并在运行OrmLiteConfigUtil时升级到Android Studio 3和gradle 3

时间:2018-02-21 12:00:47

标签: android proguard android-gradle-3.0 android-studio-3.1 aapt2

通常我能够构建我的项目但是每当有数据库更改时我需要运行OrmLiteConfigUtil并且在运行之后我会收到如下错误。它永远不会成功。我尝试探索其他问题并找到以下解决方案,但它仍然没有效果。

我尝试将Aapt2放入gradle属性文件中来禁用android.enableAapt2=false

Information:Gradle: Executing tasks: [:library:assembleDebug, :app:assembleDebug]
Information:Gradle: BUILD FAILED in 58s
Information:Modules "library", "app" were fully rebuilt due to project configuration/dependencies changes
Information:21-02-2018 05:09 PM - Compilation completed with 5 errors and 0 warnings in 1m 8s 524ms
Error:Gradle: failed to create directory 'D:\Working_folder\Fieldez_5.5.6.2\app\build\generated\source\r\debug\com\fieldez\mobile'.
Error:Gradle: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Gradle: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Gradle: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Gradle: Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt

我的项目级别gradle代码

// 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.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

应用级Gradle文件

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'let'
repositories {
    mavenCentral()
    jcenter()
    maven {
        url "https://oss.sonatype.org/content/repositories/snapshots"
    }
    maven {
        url "https://jitpack.io"
    }
    /*   maven {
           url "https://mint.splunk.com/gradle/"
       }*/
    maven { url 'https://maven.fabric.io/public' }
    maven { url "https://raw.githubusercontent.com/smilefam/SendBird-SDK-Android/master/" }
    google()
}

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.canelmas.let:let-plugin:0.1.10'
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

android {
    compileSdkVersion 'Google Inc.:Google APIs:23'
    buildToolsVersion '26.0.2'
    defaultConfig {
        vectorDrawables.useSupportLibrary = true
        applicationId "com.fieldez.mobile"
        minSdkVersion 16
        targetSdkVersion 23
        multiDexEnabled true
        dexOptions {
            javaMaxHeapSize "4g"
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildTypes {
        release {
            shrinkResources true
            minifyEnabled true
            zipAlignEnabled true
            debuggable false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        // uncomment the below 4 lines to test release build
        debug {
//            minifyEnabled true
//            shrinkResources true
//            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//            zipAlignEnabled true
        }
    }
    useLibrary 'org.apache.http.legacy'
    /*productFlavors {
        //configstring.xml debugMode == true
        debugMode {
            versionName '3.5.4'
            applicationVariants.all { variant ->
                variant.outputs.each { output ->
                    output.outputFile = new File(output.outputFile.parent,
                            output.outputFile.name.replace("app-debugMode-release", "FieldEZ Product" + "-${variant.versionName}")
                    )
                }
            }
        }
        //configstring.xml debugMode == false
        releaseMode {
            versionName '3.5.4'
            applicationVariants.all { variant ->
                variant.outputs.each { output ->
                    output.outputFile = new File(output.outputFile.parent,
                            output.outputFile.name.replace("app-releaseMode-release", "FieldEZ Product Release" + "-${variant.versionName}")
                    )
                }
            }
        }
    }*/
}

dependencies {
    implementation fileTree(dir: 'libs', include: '*.jar')

    // Play Services
    implementation 'com.google.android.gms:play-services-maps:9.0.2'
    implementation 'com.google.android.gms:play-services-location:9.0.2'
    implementation 'com.google.android.gms:play-services-gcm:9.0.2'

    //Support Libraries
    implementation 'com.android.support:appcompat-v7:24.0.0'
    implementation 'com.android.support:design:24.0.0'
    implementation 'com.android.support:recyclerview-v7:24.0.0'
    implementation 'com.android.support:cardview-v7:24.0.0'
    implementation 'com.android.support:support-v4:24.0.0'

    //ORMLite DB
    implementation 'com.j256.ormlite:ormlite-core:4.48'
    implementation 'com.j256.ormlite:ormlite-android:4.48'

    // apache http
    implementation 'org.apache.httpcomponents:httpmime:4.2.5'

    // For Date and Time Pickers
    implementation 'com.wdullaer:materialdatetimepicker:2.2.0'

    //For Images
    implementation 'com.squareup.picasso:picasso:2.5.2'

    // RecyclerView Animations
    implementation 'jp.wasabeef:recyclerview-animators:2.2.1'

    // JSON Parsing
    implementation 'com.google.code.gson:gson:2.6.2'
    implementation 'com.google.android.gms:play-services-appindexing:9.0.2'

    // For crash reports
//    compile "com.splunk.mint:mint:5.0.0"

    // Calendar
    implementation 'com.github.nikhilpanju:material-calendarview:-SNAPSHOT'
    implementation project(':library')

    //okhttp
//    compile 'com.squareup.okhttp3:okhttp:3.3.1'

    //Retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.1.0'

    //RecyclerViewEnhanced
    implementation 'com.nikhilpanju.recyclerviewenhanced:recyclerviewenhanced:1.1.0'

    //writeToPDF
    //  compile 'com.itextpdf:itextg:5.5.10'
    //multidex
    implementation 'com.android.support:multidex:1.0.1'

    //Mixpanel for analytics
    // compile "com.mixpanel.android:mixpanel-android:4.+"

    //apteligent for crash reports
    //compile 'com.crittercism:crittercism-android-agent:+'
    implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }

    // RecyclerViewHeader2
    implementation 'com.bartoszlipinski:recyclerviewheader2:2.0.1'

    // FabtoDialog
    implementation 'konifar:fab-transformation:1.0.0'

    // seeing database
    //  debugCompile 'com.amitshekhar.android:debug-db:1.0.1'

    // SendBird Chat API
    implementation 'com.sendbird.sdk:sendbird-android-sdk:3.0.26'

    // sendbird using external libraries
    // External libraries
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'org.jsoup:jsoup:1.10.2'

    // Butterknife
    //  compile 'com.jakewharton:butterknife:8.8.1'
    //  annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

    // FAB Menu (Temporarily using my PR for this library until it's merged)
    //compile 'com.github.clans:fab:1.6.4'
    implementation 'com.github.nikhilpanju:FloatingActionButton:-SNAPSHOT'

    // RXJava for Concurrency and Multithreading
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
    implementation 'io.reactivex:rxjava:1.1.0'
}

这是我的项目级别gradle.propeties文件,或者我没有它? which is my project level gradle.propeties file in these

0 个答案:

没有答案