无法使用预览编译和目标 SDK 版本构建 Android 项目。

huangapple go评论98阅读模式
英文:

Cannot build Android project with preview compile and target sdk version

问题

我尝试测试我的Android应用如何与SDK版本UpsideDownCake一起工作,该版本目前是预览版本。我将此版本应用于我的app模块,如下所示:

android {
    compileSdkPreview = "UpsideDownCake";
    buildToolsVersion = "34.0.0-rc2";
    defaultConfig {
        minSdk = 23
        targetSdkPreview = "UpsideDownCake";
    }
}

dependencies {
    implementation("com.onesignal:OneSignal:4.8.5")
    // 其他依赖项
}

以及其他(库)模块:

android {
    compileSdkPreview = "UpsideDownCake";
    buildToolsVersion = "34.0.0-rc2";
    defaultConfig {
        minSdk = 23
    }
}

dependencies {
    // 库依赖项
}

当我开始同步Android Studio与gradle文件时,我收到一些依赖项的警告。它们看起来如下:

无法解析:com.onesignal:OneSignal:4.8.5。受影响的模块:app。

我无法构建这个项目。对于这个错误,我该怎么办?

英文:

I am trying to test how my Android app would work with SDK version UpsideDownCake which is now is a preview version. I apply this version to my app module as following:

android {
    compileSdkPreview = "UpsideDownCake"
    buildToolsVersion = "34.0.0-rc2"
    defaultConfig {
        minSdk = 23
        targetSdkPreview = "UpsideDownCake"
    }
}

dependencies {
    implementation("com.onesignal:OneSignal:4.8.5")
    // Other dependecies
}

and in other (library) modules:

android {
    compileSdkPreview = "UpsideDownCake"
    buildToolsVersion = "34.0.0-rc2"
    defaultConfig {
        minSdk = 23
    }
}

dependencies {
    // Library dependencies
}

When I start to sync Android Studio with gradle files I get warnings for some of dependencies I use. They look as following:

> Failed to resolve: com.onesignal:OneSignal:4.8.5. Affected Modules: app.

I can't build this project. What can I do about this error?

答案1

得分: 1

在你的 build.gradle (Module: app) 中,你没有正确指定 OneSignal 的依赖项。根据文档,应该是这样的:

dependencies {
    implementation 'com.onesignal:OneSignal:[4.0.0, 4.99.99]'
}

你应该查看 android-sdk-setup 文档了解更多信息。

英文:

In your build.gradle (Module: app), you didn’t specify the OneSignal dependence properly
According to the documentation it should be this way

dependencies {
    implementation 'com.onesignal:OneSignal:[4.0.0, 4.99.99]'
}

you should look through the docs for the android-sdk-setup

huangapple
  • 本文由 发表于 2023年3月12日 17:24:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/75712163.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定