在导入包之后配置中由于版本与gradle不匹配,所以要进行四个文件的修改。
导入
先点击导航栏File——>Open再在弹窗目录中选择要导入的包
注意!!!导入的路径要全部英文
由于不是全英文,所以解压到别的路径中去。
配置中
由于没有修改文件配置报错
ERROR: Could not find method google() for arguments [init_32d5nvwasuhg6fwuhjcxsdq0u$_run_closure1$_closure2$_closure3$_closure5$_closure8@72c5612] on repository container.
先更改gradle版本
原
现在在文件mqradle-wrapper.properties(Gradle Version)中代码
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
配置
出现错误,修改下一个文件build.gradle (Project: GeoLib s5),GeoLib s5是我导入的包名
在repositories中添加google()方法。
原先
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
allprojects {
repositories {
jcenter()
}
}
修改之后的代码:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
// 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
}
配置之后
在控制台出现 android:minSdkVersion="19"错误,需要注释掉。
最后文件build.gradle (Module: app)中更改
apply plugin: 'com.android.application'
android {
compileSdkVersion 34
buildToolsVersion "34.0.0"
defaultConfig {
applicationId "com.example.zyaz"
minSdkVersion 15
targetSdkVersion 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'org.apache.httpcomponents:httpcore:4.4.4'
}
最后配置成功