无法从Android Studio生成Signed apk,但我可以在移动设备上运行它

从android studio生成签名的APK时出错。

  

找不到满足该版本的'junit:junit'版本   约束:依赖路径'helloworld:app:unspecified'->   'com.googlecode.json-simple:json-simple:1.1.1'->'junit:junit:4.10'   约束路径'helloworld:app:unspecified'->   由于以下原因,导致“ junit:junit:{严格地为4.10}”:   debugRuntimeclasspath使用版本4.10依赖关系路径   'helloworld:app:unspecified'->   'com.android.support.test.espresso:espresso-core:2.2.2'->   'com.android.support.test:runner:0.5'->'junit:junit:4.12'

这是我的buld.gradle文件

> apply plugin: 'com.android.application'
> 
> ext.android_support_version = '26.1.0' ext.arch_version = '1.0.0'
> ext.retrofit_version = '2.3.0'
> 
> android {
>     compileSdkVersion 26
>     defaultConfig {
>         applicationid "com.example.helloworlddeveloper"
>         minSdkVersion 16
>         targetSdkVersion 26
>         versionCode 5
>         versionName "2.0"
>         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
>         vectorDrawables.useSupportlibrary = true
>         multiDexEnabled true
>     }
>     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'
>     })
>     implementation "com.android.support:appcompat-v7:$android_support_version"
>     implementation('com.mikepenz:materialdrawer:5.9.2@aar') {
>         transitive = true
>     }
>     implementation('com.googlecode.json-simple:json-simple:1.1.1') {
>         exclude group: 'org.hamcrest',module: 'hamcrest-core'
>     }
>     implementation "com.android.support:appcompat-v7:$android_support_version"
>     implementation "com.android.support:design:$android_support_version"
>     implementation "com.android.support:recyclerview-v7:$android_support_version"
>     implementation "com.android.support:cardview-v7:$android_support_version"
>     implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
>     implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
>     implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
>     implementation 'com.github.bumptech.glide:glide:3.8.0'
>     implementation "com.android.support:support-v4:$android_support_version"
>     implementation "com.android.support:support-vector-drawable:$android_support_version"
>     testImplementation 'junit:junit:4.12'
>     implementation 'com.android.support:multidex:1.0.3'
>     implementation 'com.google.android.gms:play-services-ads:17.1.2'
>     implementation 'com.google.firebase:firebase-messaging:17.3.4'
>     implementation 'com.github.judemanutd:autostarter:1.0.3'
> 
> } apply plugin: 'com.google.gms.google-services'
pizi530 回答:无法从Android Studio生成Signed apk,但我可以在移动设备上运行它

尝试添加implementation 'com.android.support:support-annotations:26.0.0'并删除此exclude group: 'com.android.support',module: 'support-annotations'

本文链接:https://www.f2er.com/3154760.html

大家都在问