Android studio添加各种依赖
程序员文章站
2022-05-16 10:22:36
...
1.使用阿里云镜像
1.位置:
2代码:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/' }
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
依赖
1位置:
2.代码
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.examplepermissionsettinginterface"
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
//黄油
implementation 'com.jakewharton:butterknife:10.2.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
}
推荐阅读
-
Android studio怎么创建文件? 添加activity文件的教程
-
Android Studio如何使用aar依赖包?
-
Android Studio下添加assets目录的实现方法
-
Android studio怎么为项目添加模块依赖?
-
浅析Android Studio 3.0 升级各种坑(推荐)
-
Android Studio中的Gradle依赖深入讲解
-
android studio怎么添加.so文件?android studio加载so文件的方法
-
Android studio怎么删除依赖包? Android studio删除依赖模块的教程
-
Android Studio如何使用aar依赖包?
-
Android Studio下添加assets目录的实现方法