Runtime errors with library package - Android Studio Canary 6 & Canary 7

六月ゝ 毕业季﹏ 提交于 2019-12-13 08:47:33

问题


I'm unable to run the project in Canary 6 and Canary 7.

Gradle build succeeded.

At compile time it didn't show any errors.

At runtime its showing errors with all library classes(gradle dependency, jar dependency).

Some of them are,

  • error: package retrofit2 does not exist
  • error: package android.support.v7.app does not exist
  • error: package com.google.gson does not exist.
  • Error: Note: @BindView field with unresolved type (PercentRelativeLayout) must elsewhere be generated as a View or interface.

    Error:Execution failed for task ':app:compileDebugJavaWithJavac'. Compilation failed; see the compiler error output for details.

top build.gradle:

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

buildscript {

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0-alpha7'
    classpath 'com.google.gms:google-services:3.0.0'


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

allprojects {
repositories {
    google()
    jcenter()
    mavenCentral()

    maven { url "https://jitpack.io" }
}
}

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

core build.gradle:

apply plugin: 'com.android.library'

android {
compileSdkVersion 26
buildToolsVersion "26.0.0"


defaultConfig {
    minSdkVersion 15
    targetSdkVersion 26
    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(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})

testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:26.0.0-beta2'

implementation 'com.android.support:percent:26.0.0-beta2'
implementation "com.android.support:support-core-utils:26.0.0-beta2"
implementation 'com.squareup.retrofit2:retrofit:2.0.2'
implementation 'com.squareup.picasso:picasso:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
implementation 'com.squareup.okhttp3:logging-interceptor:3.2.0'
implementation 'com.intuit.sdp:sdp-android:1.0.3'
implementation 'uk.co.chrisjenx:calligraphy:2.2.0'
implementation 'com.google.code.gson:gson:2.2.4'
implementation 'com.android.support:design:26.0.0-beta2'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'

}

app build.gradle:

 buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
maven { url 'https://maven.fabric.io/public' }
}


android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
    applicationId "com.msf.phillip"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
    flavorDimensions "uat"

productFlavors {
    fullUAT {
        dimension "uat"
        versionName "1.37.2.0"
        resValue 'string', 'APP_NAME', '"Poems SG 2.0"'
        buildConfigField "String", "VERSION", "\"1.2.2.0\""
        buildConfigField  "String", "connection_env", "\"uat\""
        buildConfigField  "String", "connection_url", "*******"
        buildConfigField "String", "API_KEY", "************"
        buildConfigField "boolean", "mandatoryUpdate", "false"
        buildConfigField "String", "FLURRY_API_KEY", "*************"

    }

    fullRelease {
        dimension "uat"
        versionName "1.0.4.0"
        resValue 'string', 'APP_NAME', '"Poems"'
        buildConfigField "boolean", "isUAT", "false"
        buildConfigField "boolean", "isInternal", "false"
        buildConfigField "String", "VERSION",  "\"1.0.0\""
        buildConfigField  "String", "connection_env", "\"prod\""
        buildConfigField  "String", "connection_url", "*************"
        buildConfigField "String", "API_KEY", "**************"
        buildConfigField "boolean", "mandatoryUpdate", "false"
        buildConfigField "String", "FLURRY_API_KEY", "************"

    }
}
}

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(path: ':core')
implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
implementation 'com.google.android.gms:play-services-gcm:11.0.2'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.flurry.android:analytics:7.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
implementation 'com.jakewharton:butterknife:8.6.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
    transitive = true;
}
}
apply plugin: 'com.google.gms.google-services'

来源:https://stackoverflow.com/questions/45204273/runtime-errors-with-library-package-android-studio-canary-6-canary-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!