Closed rgbinnovation closed 4 years ago
there are two kinds of dependencies
blocks. One is for dependencies for the build tools, that's the one in the buildscript
block. The other is the dependencies for the app you're building.
implementation
is only for the second kind.
The problem is caused by you adding
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
do the buildscript
dependencies block. it should be outside of the buildscript block.
also, you shouldn't be applying the plugins inside of the buildscript block.
I think what you want is something more like
app/build.gradle:
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.10.2, 0.99.99]'
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
According to the above configuration, the operation still reports an error.
/build.gradle
buildscript {
ext.kotlin_version = '1.2.31'
repositories {
google()
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
/app/build.gradle
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
error info
Try to update to the latest version of the package.
App Gradle:
Android Gradle:
My error:
Anyone has any idea? Thanks!