最近,我更改了系统,当我尝试在新的MacBook中构建应用程序时,它不是使用领域构建的。 android中的两个错误。 1)配置项目':realm'时出现问题。
未指定compileSdkVersion。 2)评估项目':realm'时发生问题。 扩展程序尚未初始化,无法访问compileSdkVersion。 并在iOS中表示找不到领域构造函数。
我已经在主gradle文件和realm模块的gradle文件中检查了compilesdk版本。他们看起来很好。
{
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$projectDir/../../react-native/android"
}
}
}
apply plugin: 'com.android.library'
task forwardDebugPort(type: Exec) {
def adb = android.getAdbExe()?.toString() ?: 'false'
commandLine adb, 'forward', 'tcp:8083', 'tcp:8083'
ignoreExitValue true
doLast {
if (execResult.getExitValue() != 0) {
logger.error(
'===========================================================================\n' +
'WARNING: Failed to automatically forward port 8083.\n' +
'In order to use Realm in Chrome debugging mode, port 8083 must be forwarded\n' +
'from localhost to the device or emulator being used to run the application.\n' +
'You may need to add the appropriate flags to the command that failed:\n' +
' adb forward tcp:8083 tcp:8083\n' +
'===========================================================================\n'
)
}
}
}
android {
compileSdkVersion rootProject.hasProperty("compileSdkVersion") ? rootProject.compileSdkVersion : 28
buildToolsVersion rootProject.hasProperty("buildToolsVersion") ? rootProject.buildToolsVersion : "28.0.3"
defaultConfig {
minSdkVersion rootProject.hasProperty("minSdkVersion") ? rootProject.minSdkVersion : 16
targetSdkVersion rootProject.hasProperty("targetSdkVersion") ? rootProject.targetSdkVersion : 28
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn forwardDebugPort
}
}
def dependencyType = "implementation"
try {
project.getConfigurations().getByName("implementation")
} catch (UnknownConfigurationException e) {
dependencyType = "compile" // Pre 3.0 Android Gradle Plugin
}
project.dependencies {
add(dependencyType, fileTree(dir: 'libs', include: ['*.jar']))
add(dependencyType, 'org.nanohttpd:nanohttpd:2.2.0')
add(dependencyType, 'com.facebook.react:react-native:+')
}
}