日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Android >内容正文

Android

Android Stdio换源以及配置项目

發布時間:2025/5/22 Android 57 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Android Stdio换源以及配置项目 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

文章目錄

    • 換阿里源
    • 方法二(待測)
    • 換源

換阿里源

  • 對特定項目生效,在項目中的build.gradle修改內容
  • // 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/' }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' }}dependencies {classpath "com.android.tools.build:gradle:4.2.2"// 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' }} }task clean(type: Delete) {delete rootProject.buildDir }
  • 對所有項目生效
    在C:\Users\Administrator\.gradle下創建init.gradle文件
  • allprojects{repositories {def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'def ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter'all { ArtifactRepository repo ->if(repo instanceof MavenArtifactRepository){def url = repo.url.toString()if (url.startsWith('https://repo1.maven.org/maven2')) {project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."remove repo}if (url.startsWith('https://jcenter.bintray.com/')) {project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."remove repo}}}maven {url ALIYUN_REPOSITORY_URLurl ALIYUN_JCENTER_URL}} }

    方法二(待測)

    換源

    build.gradle

    // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript {repositories {google()jcenter()maven { url 'https://jitpack.io' }}dependencies {classpath "com.android.tools.build:gradle:4.0.1"classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.10'// 資源混淆插件:https://github.com/shwenzhang/AndResGuardclasspath 'com.tencent.mm:AndResGuard-gradle-plugin:1.2.17'// NOTE: Do not place your application dependencies here; they belong// in the individual module build.gradle files} }allprojects {repositories {google()jcenter()maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }maven { url 'https://maven.aliyun.com/nexus/content/repositories/central/' }maven { url 'https://dl.bintray.com/getactivity/maven/' }maven { url 'https://dl.bintray.com/umsdk/release' }maven { url 'https://maven.google.com' }maven { url 'https://jitpack.io' }} }task clean(type: Delete) {delete rootProject.buildDir }

    config.gradle

    // 通用配置 android {compileSdkVersion 31defaultConfig {minSdkVersion 16targetSdkVersion 31versionName '1.0'versionCode 10}// 支持 Java JDK 8compileOptions {targetCompatibility JavaVersion.VERSION_1_8sourceCompatibility JavaVersion.VERSION_1_8}// 設置存放 so 文件的目錄sourceSets {main {jniLibs.srcDirs = ['libs']}} }dependencies {// 依賴 libs 目錄下所有 jar 包implementation fileTree(include: ['*.jar'], dir: 'libs')// 依賴 libs 目錄下所有 aar 包implementation fileTree(include: ['*.aar'], dir: 'libs')// 谷歌兼容庫:https://developer.android.google.cn/jetpack/androidx/releases/appcompat?hl=zh-cnimplementation 'androidx.appcompat:appcompat:1.3.0-alpha01'implementation 'com.google.android.material:material:1.3.0-alpha01' }

    參考文章:
    https://www.cnblogs.com/qianmaoliugou/p/12369654.html

    總結

    以上是生活随笔為你收集整理的Android Stdio换源以及配置项目的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。