我正在尝试使用Carto Mobile SDK,但Android Studio会告诉我Unresolved reference: com.carto.ui.MapView
。
我有最新的Android Studio Canary,我更新了gradle和kotlin插件,但仍无效。
这只发生在Android Studio 3.0 Canary中,适用于Android Studio 2.3.3。
这些是我的gradle文件:
Project gradle:
buildscript {
ext.kotlin_version = '1.1.3'
ext.anko_version = '0.10.1'
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "me.mcordoba.test"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile "org.jetbrains.anko:anko-commons:$anko_version"
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:support-v4:25.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.carto:carto-mobile-sdk:4.0.2@aar'
testCompile 'junit:junit:4.12'
}
答案 0 :(得分:0)
1.将classpath a[i]=0
添加到项目gradle的 buildscript-dependencies
2.添加org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version
在apply plugin: 'kotlin-android'
app gradle之后apply plugin: 'kotlin-android-extensions'
。
对我来说,它发生在Android studio 3.1上。