Android studio19版导入包配置

本文介绍了如何处理在导入包后由于Gradle版本不匹配引发的问题,包括修改`gradle-wrapper.properties`和`build.gradle`文件中的版本设置,以及解决`android:minSdkVersion`错误的过程。
摘要由CSDN通过智能技术生成

    在导入包之后配置中由于版本与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'
}

最后配置成功

  • 11
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值