.../platforms/android/app/src/main/java/com/tenforwardconsulting/cordova/BackgroundGeolocationPlugin.java:563: error: cannot find symbol @TargetApi(Build.VERSION_CODES.KITKAT) ^ symbol: variable KITKAT location: class VERSION_CODES .../platforms/android/app/src/main/java/com/redskyit/mobile/common/RMCActivity.java:79: error: cannot find symbol window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); ^ symbol: variable FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS location: class LayoutParams
我得到了这些+数百个其他类似的错误(所有人都找不到符号错误)。
我正在将一个项目迁移到cordova8。Cordova8已经相当大地改变了android项目,并且我正在解决所提出的各种问题。我正处在开始编译的阶段,但是由于这些错误而失败。
顶层build.gradle
如下
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
//This replaces project.properties w.r.t. build settings
project.ext {
defaultBuildToolsVersion="25.0.2" //String
defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
defaultTargetSdkVersion=26 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=26 //Integer - We ALWAYS compile with the latest by default
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app\build.gradle
中有这些(还有更多)
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
...
dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
implementation(project(path: ":CordovaLib"))
compile "com.google.android.gms:play-services-location:+"
compile "com.android.support:support-v4:26+"
compile "com.android.support:support-v4:24.1.1+"
compile "com.google.gms:google-services:+"
compile "com.google.android.gms:play-services-tagmanager:+"
compile "com.google.firebase:firebase-core:+"
compile "com.google.firebase:firebase-messaging:+"
compile "com.google.firebase:firebase-crash:+"
compile "com.google.firebase:firebase-config:+"
// SUB-PROJECT DEPENDENCIES END
}
我不熟悉android studio项目和gradle,所以真的不知道从哪里开始。我认为这是缺少的依赖关系或类似的东西。
答案 0 :(得分:0)
尝试Build > Clean Project
,如果不起作用Build> Rebuild Project
,如果也不起作用,则尝试File > Invalidate Caches & Restart
。可能会解决您的问题。
答案 1 :(得分:0)
我最终将其归结为插件定义的一些依赖关系,这是我分叉的。依赖关系是:-
dependencies {
compile 'com.github.tony19:logback-android-core:1.1.1-6'
compile 'com.github.tony19:logback-android-classic:1.1.1-6'
compile 'org.slf4j:slf4j-api:1.7.21'
}
解决方法是排除logback-android-classic
的某些依赖项,如下所示:
dependencies {
compile 'com.github.tony19:logback-android-core:1.1.1-6'
compile('com.github.tony19:logback-android-classic:1.1.1-6') {
exclude group: 'com.google.android', module: 'android'
}
compile 'org.slf4j:slf4j-api:1.7.21'
}