更新:已修复
ext.kotlin_version = ’1.3.11’
apply plugin: ’com.android.application’apply plugin: ’kotlin-android’apply plugin: ’kotlin-android-extensions’apply plugin: ’io.fabric’android { compileSdkVersion 28 buildToolsversion '28.0.3' defaultConfig {versionName '2.2.4'versionCode 13minSdkVersion 16targetSdkVersion 27testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'vectorDrawables.useSupportLibrary = true } buildTypes {debug { applicationIdSuffix '.debug' versionNameSuffix '.d.5'}release {minifyEnabled false proguardFiles getDefaultProguardFile(’proguard-android.txt’), ’proguard-rules.pro’} } flavorDimensions 'server' productFlavors {prod { applicationId 'com.tfwm.lighting' dimension 'server' buildConfigField 'String', 'SERVER_HOST', ''http://www.crescit.com''}dev { applicationId 'dev.tfwm.lighting' versionNameSuffix '.dev' dimension 'server' buildConfigField 'String', 'SERVER_HOST', ''http://192.168.60.120''} }}dependencies { implementation filetree(include: [’*.jar’], dir: ’libs’) androidTestImplementation(’com.android.support.test.espresso:espresso-core:2.2.2’, {exclude group: ’com.android.support’, module: ’support-annotations’ }) implementation(’com.crashlytics.sdk.android:crashlytics:2.7.1@aar’) {transitive = true } implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version' implementation ’com.github.sparklit:adbutler-android-sdk:1.0’ implementation ’com.j256.ormlite:ormlite-core:5.0’ implementation ’com.j256.ormlite:ormlite-android:5.0’ implementation ’com.squareup.okhttp:okhttp:2.4.0’ implementation ’com.android.support:appcompat-v7:28.0.0’ implementation ’com.android.support:cardview-v7:28.0.0’ implementation ’com.android.support:recyclerview-v7:28.0.0’ implementation ’com.android.support:design:28.0.0’ implementation ’com.android.support:support-vector-drawable:28.0.0’ implementation ’com.android.support.constraint:constraint-layout:1.1.3’ implementation ’com.android.support:support-v4:28.0.0’ implementation ’com.google.android.gms:play-services-location:16.0.0’ implementation ’com.google.firebase:firebase-core:16.0.7’ implementation ’com.facebook.fresco:fresco:1.9.0’ implementation ’com.jakewharton.timber:timber:4.7.0’ implementation ’com.google.android.gms:play-services-maps:16.1.0’ testImplementation ’junit:junit:4.12’ def nav_version = '1.0.0-alpha09' implementation 'android.arch.navigation:navigation-fragment:$nav_version' // use -ktx for Kotlin implementation 'android.arch.navigation:navigation-ui:$nav_version' // use -ktx for Kotlin implementation ’pub.devrel:easypermissions:1.1.1’ implementation ’devlight.io:navigationtabbar:1.2.5’}apply plugin: ’com.google.gms.google-services’repositories { mavenCentral()}解决方法
我无法编译Android Kotlin项目
我最近将应用程序从纯Java更新为Kotlin,但仅在单个活动中完成了该操作,但无法运行该项目。
摇篮日志
e:无法解析以下类的超类型。请确保您在类路径中具有必需的依赖项:com.google.android.gms.maps.model.LatLng类,未解析的超类:com.google.android.gms.internal.zzbfm类com.google.android.gms。maps.model.CameraPosition,未解析的超类型:com.google.android.gms.internal.zzbfm
建立gradle(应用程式)
apply plugin: ’com.android.application’apply plugin: ’kotlin-android-extensions’apply plugin: ’kotlin-android’apply plugin: ’io.fabric’android { compileSdkVersion 28 buildToolsVersion '28.0.3' defaultConfig {versionName '2.2.4'versionCode 13minSdkVersion 16targetSdkVersion 27testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'vectorDrawables.useSupportLibrary = true } buildTypes {debug { applicationIdSuffix '.debug' versionNameSuffix '.d.5'}release { minifyEnabled false proguardFiles getDefaultProguardFile(’proguard-android.txt’),’proguard-rules.pro’} } flavorDimensions 'server' productFlavors {prod { applicationId 'com.app.app' dimension 'server' buildConfigField 'String','SERVER_HOST',''http://www.test.cm'' }dev { applicationId 'dev.app.app' versionNameSuffix '.dev' dimension 'server' buildConfigField 'String',''http://localhost/test''} }}dependencies { implementation fileTree(include: [’*.jar’],dir: ’libs’) androidTestImplementation(’com.android.support.test.espresso:espresso-core:2.2.2’,{exclude group: ’com.android.support’,module: ’support-annotations’ }) implementation(’com.crashlytics.sdk.android:crashlytics:2.7.1@aar’) {transitive = true } implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version' implementation ’com.github.sparklit:adbutler-android-sdk:1.0’ implementation ’com.j256.ormlite:ormlite-core:4.48’ implementation ’com.j256.ormlite:ormlite-android:4.48’ implementation ’com.squareup.okhttp:okhttp:2.4.0’ implementation ’com.android.support:appcompat-v7:28.0.0’ implementation ’com.android.support:cardview-v7:28.0.0’ implementation ’com.android.support:recyclerview-v7:28.0.0’ implementation ’com.android.support:design:28.0.0’ implementation ’com.android.support:support-vector-drawable:28.0.0’ implementation ’com.android.support.constraint:constraint-layout:1.1.2’ implementation ’com.android.support:support-v4:28.0.0’ implementation ’com.google.android.gms:play-services-location:15.0.0’ implementation ’com.google.firebase:firebase-core:16.0.1’ implementation ’com.facebook.fresco:fresco:1.9.0’ implementation ’com.jakewharton.timber:timber:4.7.0’ implementation ’com.google.android.gms:play-services-maps:11.8.0’ testImplementation ’junit:junit:4.12’ def nav_version = '1.0.0-alpha09' implementation 'android.arch.navigation:navigation-fragment:$nav_version' // use -ktx for Kotlin implementation 'android.arch.navigation:navigation-ui:$nav_version' // use -ktx for Kotlin implementation ’devlight.io:navigationtabbar:1.2.5’}apply plugin: ’com.google.gms.google-services’repositories { mavenCentral()}