在Android工作室更新得到以下错误后,任何人都可以帮我2解决

时间:2017-11-08 10:15:40

标签: java android build.gradle android-studio-3.0

我以前的android-Studio 2.2.3 版本,我已更新为 3.0 获得了之前未发生过的errorsv7。我想通过添加 Error:(158, 30) error: cannot find symbol method setHomeAsUpIndicator(int) Error:(152, 9) error: cannot find symbol method setSupportActionBar(Toolbar) Error:Execution failed for task ':app:compileDebugJavaWithJavac'. > Compilation failed; see the compiler error output for details. lib来解决这个问题,所有人都没有解决这个问题,请帮助我。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "com.example.bixx"
        multiDexEnabled true
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 201709021
        versionName "1.42.0"
    }

    lintOptions {
        // Turns off checks for the issue IDs you specify.
        disable 'TypographyFractions','TypographyQuotes'
        // Turns on checks for the issue IDs you specify. These checks are in
        // addition to the default lint checks.
        enable 'RtlHardcoded','RtlCompat', 'RtlEnabled'
        // To enable checks for only a subset of issue IDs and ignore all others,
        // list the issue IDs with the 'check' property instead. This property overrides
        // any issue IDs you enable or disable using the properties above.
        check 'NewApi', 'InlinedApi'
        // If set to true, turns off analysis progress reporting by lint.
        quiet true
        // if set to true (default), stops the build if errors are found.
        abortOnError false
        // if true, only report errors.
        ignoreWarnings true
    }

    dexOptions {
        preDexLibraries = false
        javaMaxHeapSize "2048M"
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:support-v4:26.0.2'
    //Added
    compile 'com.android.support:appcompat-v7:26.0.2'
    //Added
    compile 'com.google.apis:google-api-services-urlshortener:v1-rev47-1.22.0'
    compile project(':breadcrumb')
    compile project(':twowaygridview')
    compile project(':simple-crop-image-lib')
    compile project(':cropper')
    compile files('libs/universal-image-loader-1.9.4-SNAPSHOT.jar')
    compile files('libs/acra-4.5.0.jar')
    compile files('libs/gson-2.2.2.jar')
    compile files('libs/httpmime-4.0.1.jar')
    compile files('libs/apache-mime4j-0.6.jar')
    compile files('libs/WebSocket.jar')
    compile files('libs/droidText.0.2.jar')
    compile files('libs/itextpdf-5.5.6.jar')
    compile files('libs/picasso-2.5.2.jar')
    compile files('libs/razorpay-android-0.10.0.jar')
    compile project(':Emoji')
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.github.johnkil.print:print:1.2.2'
    compile 'com.github.nkzawa:socket.io-client:0.5.2'
    compile 'com.android.support:design:26.0.2'
    compile 'com.android.support:cardview-v7:26.0.2'
    compile 'com.google.firebase:firebase-messaging:9.6.0'
    compile files('libs/android-query-full.0.26.8.jar')
    compile files('libs/YouTubeAndroidPlayerApi.jar')
    compile 'com.android.support:support-v4:26.0.2'
    compile 'com.squareup.okhttp3:okhttp:3.0.0-RC1'
    compile 'com.github.chrisbanes:PhotoView:1.3.0'
    compile 'com.android.support:support-core-utils:26.0.2'
    implementation files('libs/android-support-v7-appcompat.jar')
    implementation files('libs/android-support-v4.jar')
}

afterEvaluate {
    tasks.matching {
        it.name.startsWith('dex')
    }.each { dx ->
        if (dx.additionalParameters == null) {
            dx.additionalParameters = ['--multi-dex']
        } else {
            dx.additionalParameters += '--multi-dex'
        }
    }
}

apply plugin: 'com.google.gms.google-services'

正如您想要的构建即时发布。

  

的build.gradle

lambda

2 个答案:

答案 0 :(得分:0)

这是因为您有冲突的依赖项。您不能同时使用maven和jar中的支持库。您只需要使用其中一个。您最好使用maven的支持库以便于维护。所以,清理你的依赖关系是这样的:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:support-v4:26.0.2'
    // the appcompat-v7 is already included in design library implicitly.
    //compile 'com.android.support:appcompat-v7:26.0.2'
    compile 'com.android.support:design:26.0.2'
    compile 'com.android.support:cardview-v7:26.0.2'
    compile 'com.android.support:support-core-utils:26.0.2'
    compile 'com.android.support:multidex:1.0.1'

    compile 'com.google.apis:google-api-services-urlshortener:v1-rev47-1.22.0'
    compile project(':breadcrumb')
    compile project(':twowaygridview')
    compile project(':simple-crop-image-lib')
    compile project(':cropper')
    compile files('libs/universal-image-loader-1.9.4-SNAPSHOT.jar')
    compile files('libs/acra-4.5.0.jar')
    compile files('libs/gson-2.2.2.jar')
    compile files('libs/httpmime-4.0.1.jar')
    compile files('libs/apache-mime4j-0.6.jar')
    compile files('libs/WebSocket.jar')
    compile files('libs/droidText.0.2.jar')
    compile files('libs/itextpdf-5.5.6.jar')
    compile files('libs/picasso-2.5.2.jar')
    compile files('libs/razorpay-android-0.10.0.jar')
    compile project(':Emoji')
    compile 'com.github.johnkil.print:print:1.2.2'
    compile 'com.github.nkzawa:socket.io-client:0.5.2'
    compile 'com.google.firebase:firebase-messaging:9.6.0'
    compile files('libs/android-query-full.0.26.8.jar')
    compile files('libs/YouTubeAndroidPlayerApi.jar')
    compile 'com.squareup.okhttp3:okhttp:3.0.0-RC1'
    compile 'com.github.chrisbanes:PhotoView:1.3.0'
}

答案 1 :(得分:0)

我已经解决了添加的问题 编译'com.google.android.gms:play-services:11.6.2' 在.build(app)中,再次从项目结构向项目库中的app添加依赖jar文件。

jar文件,如android-support-v7-appcompat.jar,apache-mime-4j-06.jar