【问题标题】:I'm having error Trying to Build my apk : failed to resolve com.android.support:support-v4:26.0.0我在尝试构建我的 apk 时遇到错误:无法解析 com.android.support:support-v4:26.0.0
【发布时间】:2017-08-23 22:23:24
【问题描述】:

这是我的构建 gradle,对修复此错误有帮助吗?我也有错误:

解析 com.google.android.gms:play-services-maps:14.0.4 失败

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.0'
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "com.Kreatech.handje"
        minSdkVersion 23
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile files('libs/httpmime-4.1.3.jar')
    //===============
    compile 'com.mikhaellopez:circularimageview:2.0.2'
    compile 'com.mcxiaoke.volley:library:1.0.6@aar'
    compile files('libs/Parse-1.6.0.jar')
    compile 'junit:junit:4.12'
    compile 'com.android.support:support-v4:26.0.0'
    compile 'com.google.android.gms:play-services-maps:14.0.4'
    compile 'com.google.android.gms:play-services-ads:11.0.4'
    compile 'com.google.android.gms:play-services-auth:11.0.4'
    compile 'com.google.android.gms:play-services-gcm:11.0.4'
}

【问题讨论】:

标签: javascript android html android-studio


【解决方案1】:

https://developer.android.com/topic/libraries/support-library/setup.html

要将支持库添加到您的应用程序项目中:

为您的应用打开 build.gradle 文件。确保 存储库部分包括一个 Maven 部分,其中 “https://maven.google.com”端点。例如:

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

【讨论】:

  • 谢谢它现在可以工作,我收到以下错误,错误:任务':app:processReleaseResources'的执行失败。 > com.android.ide.common.process.ProcessException: 无法执行 aapt
【解决方案2】:

将此代码添加到应用程序级别的build.gradle文件中

allprojects {
repositories {
    jcenter()
    maven {
        url "https://maven.google.com"
    }
}
}

【讨论】:

  • 它工作了,但现在我有 6Errors :: Error:(3, 29) 找不到与给定名称匹配的资源(在 'drawable' 处,值为 '@drawable/common_google_signin_btn_icon_light_normal_background')。
【解决方案3】:

我最终得到了一个需要旧版本支持库的 gradle 依赖项,因此构建决定使用旧版本。

我通过运行here 描述的“Gradle 依赖关系报告”发现了这一点:

./gradlew -q dependencies app:dependencies \
  --configuration debugAndroidTestCompileClasspath >& foo.txt

然后我更新了旧的依赖项,这开始起作用了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-01-16
    • 2023-03-11
    • 2018-01-05
    • 2019-07-30
    • 2020-01-09
    • 2020-08-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多