簡體   English   中英

我如何使我的應用程序運行並解決此錯誤

[英]How can i made my app run and solve this error

我當時在android上制作移動應用程序,卻遇到了一些我無法解決的錯誤。 像第一個錯誤

我對應用的興趣是

apply plugin: 'com.android.application'
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"
    defaultConfig {
        applicationId "com.example.dygy.chat"
        minSdkVersion 16
        targetSdkVersion 25
        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 {
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:25.3.1'
    exclude group: 'com.android.support', module: 'support-v7'
    testCompile 'junit:junit:4.12'
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })




    //Add Library
    compile 'com.android.support:design:25.3.1'
    compile 'com.firebaseui:firebase-ui:0.6.2'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.google.firebase:firebase-auth:10.0.1'
    compile 'com.google.firebase:firebase-database:10.0.1'
    compile 'com.google.firebase:firebase-storage:10.0.1'
    compile 'com.google.firebase:firebase-config:10.0.1'
    compile 'com.google.firebase:firebase-crash:10.0.1'
}
apply plugin: 'com.google.gms.google-services'

我加了

exclude group: 'com.android.support', module: 'support-v7+'

還添加

compile 'com.android.support:multidex:1.0.1'

 multiDexEnabled true

將支持從25.0.1升級到25.3.1,並且以相同的方式進行設計,因為它在添加multidex 1.0.1之后向我推薦了我該怎么做? 按下升級插件不會執行任何操作。 一天前,我進入了github完整項目,因此如果需要,請繼續

另外,還有些錯誤

錯誤:任務':app:transformClassesWithJarMergingForDebug'的執行失敗。 > com.android.build.api.transform.TransformException:java.util.zip.ZipException:重復條目:com / google / android / gms / auth / api / signin / internal / zzf.class比ppl告訴我要引導重建項目,所以現在像

(30,1)評估項目':app'時發生問題。 >在類型為org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDe‌pendencyHandler的對象上的參數[{group = com.android.support,module = support-v7}]上找不到方法exclude()。 所以我改變了

 compile 'com.android.support:appcompat-v7:25.3.1' {
        exclude group: 'com.android.support', module: 'support-v7'
    }

但現在這是我的故事

 Error:(29, 0) Could not find method com.android.support:appcompat-v7:25.3.1() for arguments 

類型為org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDe‌pendencyHandler的對象上的[build_kymyozhw5iecrml565pxornd $ _run_closure2 $ _closure7 @ 3e83‌7d7]。 請從Android SDK Manager安裝Android支持存儲庫。 打開Android SDK Manager

但它們都已安裝! 因此我不確定是否要更改某些問題,還是只是添加新的問題。 請幫幫我。

編輯現在,在第一個答案之后,我的收獲是:

apply plugin: 'com.android.application'
android {

    compileSdkVersion 25
    buildToolsVersion "25.0.1"
    defaultConfig {
        applicationId "com.example.dygy.chat"
        minSdkVersion 16
        targetSdkVersion 25
        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 {
    compile 'com.android.support:multidex:1.0.1'
    compile ('com.android.support:appcompat-v7:25.3.1') {
        exclude group: 'com.android.support', module: 'support-v7'
    }
    testCompile 'junit:junit:4.12'
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2') {
        exclude group: 'com.android.support', module: 'support-annotations'
    }
    //Add Library
    compile 'com.android.support:design:25.3.1'
    compile 'com.firebaseui:firebase-ui:0.6.2'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.google.firebase:firebase-auth:10.0.1'
    compile 'com.google.firebase:firebase-database:10.0.1'
    compile 'com.google.firebase:firebase-storage:10.0.1'
    compile 'com.google.firebase:firebase-config:10.0.1'
    compile 'com.google.firebase:firebase-crash:10.0.1'
}
apply plugin: 'com.google.gms.google-services'

我有這個錯誤

錯誤:任務':app:transformClassesWithJarMergingForDebug'的執行失敗。

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重復項:com / google / android / gms / auth / api / signin / internal / zzf.class

當您在花括號中添加括號時,需要在前一個參數周圍使用括號。

IOW,更換:

compile 'com.android.support:appcompat-v7:25.3.1' {
    exclude group: 'com.android.support', module: 'support-v7'
}

有:

compile ('com.android.support:appcompat-v7:25.3.1') {
    exclude group: 'com.android.support', module: 'support-v7'
}

並替換:

androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})

有:

androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2') {
    exclude group: 'com.android.support', module: 'support-annotations'
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM