简体   繁体   English

我如何使我的应用程序运行并解决此错误

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

I was making mobile app on android, and get some really some errors, that i wasn't available to solve. 我当时在android上制作移动应用程序,却遇到了一些我无法解决的错误。 First error was like this 像第一个错误

my gradle for app is 我对应用的兴趣是

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'

i added 我加了

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

also add 还添加

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

and

 multiDexEnabled true

Upgraded support to 25.3.1 from 25.0.1 and design same way because it recommended to me after adding multidex 1.0.1 What do I need to do? 将支持从25.0.1升级到25.3.1,并且以相同的方式进行设计,因为它在添加multidex 1.0.1之后向我推荐了我该怎么做? Press on upgrade plugin does nothing. 按下升级插件不会执行任何操作。 A day ago, I pushed into github full project, so if it needed here you go 一天前,我进入了github完整项目,因此如果需要,请继续

also, it took some error kinda 另外,还有些错误

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. 错误:任务':app:transformClassesWithJarMergingForDebug'的执行失败。 > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class than ppl tell me to clead-rebuild project, so it now sayng like > com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com / google / android / gms / auth / api / signin / internal / zzf.class比ppl告诉我要引导重建项目,所以现在像

(30, 1) A problem occurred evaluating project ':app'. (30,1)评估项目':app'时发生问题。 > Could not find method exclude() for arguments [{group=com.android.support, module=support-v7}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDe‌​pendencyHandler. >在类型为org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDe‌pendencyHandler的对象上的参数[{group = com.android.support,module = support-v7}]上找不到方法exclude()。 so i make change to 所以我改变了

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

but now it's tale me 但现在这是我的故事

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

[build_kymyozhw5iecrml565pxornd$_run_closure2$_closure7@3e83‌​7d7] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDe‌​pendencyHandler. 类型为org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDe‌pendencyHandler的对象上的[build_kymyozhw5iecrml565pxornd $ _run_closure2 $ _closure7 @ 3e83‌7d7]。 Please install the Android Support Repository from the Android SDK Manager. 请从Android SDK Manager安装Android支持存储库。 Open Android SDK Manager 打开Android SDK Manager

but they all was installed! 但它们都已安装! so I'm not sure if I change some problems, or just adding new ones. 因此我不确定是否要更改某些问题,还是只是添加新的问题。 Please help me out. 请帮帮我。

EDIT Now after first answer my gradle is: 编辑现在,在第一个答案之后,我的收获是:

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'

and I have this error 我有这个错误

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. 错误:任务':app:transformClassesWithJarMergingForDebug'的执行失败。

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复项:com / google / android / gms / auth / api / signin / internal / zzf.class

When you braces to add a closure to Gradle, you need to use parentheses around the preceding argument. 当您在花括号中添加括号时,需要在前一个参数周围使用括号。

IOW, replace: IOW,更换:

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

with: 有:

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

and replace: 并替换:

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

with: 有:

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