我目前在尝试导入android studio项目时遇到一些问题。
最初,在导入项目时,我会遇到:
Unable to get Gradle wrapper properties from: C:\Users\user\Downloads\topic 6.3\topic6\gradle\wrapper\gradle-wrapper.properties
我点击“确定”以创建文件和项目加载。然后,我尝试构建该项目,但是遇到了:
ERROR: Plugin with id 'com.android.application' not found.
原始gradle文件如下:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "mad.topic6"
minSdkVersion 19
// so we don't need runtime permissions
targetSdkVersion 26
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
//https://github.com/SQLDroid/SQLDroid/
// latest release
//implementation 'org.sqldroid:sqldroid:1.0.3'
// latest release candidate (RC)
implementation 'org.sqldroid:sqldroid:1.1.0-rc1'
implementation 'com.android.support:support-fragment:27.1.1'
}
我可以通过将其添加到gradle文件的顶部来解决第一个问题:
buildscript {
repositories {
google() // For Gradle 4.0+
maven { url 'https://maven.google.com' } // For Gradle < 4.0
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
}
}
这解决了问题,但随后我遇到了:
Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.11.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.11/kotlin-stdlib-jdk8-1.3.11.pom
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.11/kotlin-stdlib-jdk8-1.3.11.jar
- https://maven.google.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.11/kotlin-stdlib-jdk8-1.3.11.pom
- https://maven.google.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.11/kotlin-stdlib-jdk8-1.3.11.jar
我无法找到解决此问题的方法。
答案 0 :(得分:0)
将您的项目级别gradle文件更改为此
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.30'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}