gpt4 book ai didi

android - Android Studio 3 Canary中 Unresolved reference

转载 作者:行者123 更新时间:2023-12-03 04:27:32 29 4
gpt4 key购买 nike

我正在尝试使用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文件:

项目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
}

应用程式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'
}

最佳答案

1.将类路径org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version添加到项目gradle的构建脚本依赖

2.添加apply plugin: 'kotlin-android' 应用gradle的apply plugin: 'kotlin-android-extensions'之后的apply plugin: 'com.android.application'

对我来说,它发生在Android Studio 3.1上。

关于android - Android Studio 3 Canary中 Unresolved reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44856606/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com