Mah*_*bar 10 gradle kotlin android-studio-3.0
我使用android studio 3.0和一些旧的java类将Java转换为Kotlin.之后,Kotlin类无法在java类中导入!在下面你可以看到我的成绩和我的错误图片.
模块build.grade
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)
在应用程序级别build.gradel通常我使用gradel代码和Android 3.0我认为我们需要任何东西
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.idehnavazan.beautifierclient"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dataBinding {
enabled = true
}
}
repositories {
mavenCentral()
jcenter()
maven { url 'https://maven.google.com' }
maven { url 'https://jitpack.io' }
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.github.rey5137:material:1.2.2'
compile 'com.android.support:cardview-v7:25.3.1'
}
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)
Eug*_*nec 34
要使用Kotlin文件,您需要将Kotlin添加到您的项目中.
buildscript {
ext.kotlinVersion = '1.1.51'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
Run Code Online (Sandbox Code Playgroud)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
}
Run Code Online (Sandbox Code Playgroud)
由于您使用的是支持库25.3.1和Android插件3.0.0,您的下一个问题可能是:未找到样式属性'@android:attr/windowEnterAnimation'.
| 归档时间: |
|
| 查看次数: |
6917 次 |
| 最近记录: |