android - gradlew assembleRelease 抛出 compileSdkVersion is not specified 错误
问题描述
我正在使用 gradle 构建一个反应原生应用程序。我最近更新了我的 Android SDK,现在抛出以下错误:
* What went wrong:
A problem occurred configuring project ':react-native-navigation'.
> compileSdkVersion is not specified.
这是我的顶级 gradle.build:
buildscript {
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 16
compileSdkVersion = 29
targetSdkVersion = 29
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.3")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
这是我在模块内部的构建脚本:
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.myapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
有人知道我该如何解决吗?
解决方案
我通过在 local.properties 文件中添加 ndk.dir 解决了这个问题。local.properties 文件应该是这样的。
ndk.dir=/Users/[username]/Library/Android/sdk/ndk/your ndkversion ////23.1.7779620 sdk.dir=/Users/[username]/Library/Android/sdk
推荐阅读
- reactjs - React - 错误:渲染的钩子比上一次渲染时更多
- python - 集成 pyenv virtualenv conda 和 ASE 的最佳实践
- discord.py - Discord.py 垃圾邮件
- r - 使用 fwrite 导出 csv 后将分类字段转换为连续字段
- mongodb - 在 MongoDb 上使用地理空间索引的汉明距离?
- java - 过程 myProcedure (text, text) 不存在 提示:没有过程与给定名称和参数类型匹配
- php - wordpress 404.php 页面未加载排队脚本
- elf - nm 型 g 和 G
- powershell - Azure devops 创建自定义标签
- c++ - 有没有办法在 QTextEdit 中显示堆叠的文本