diff --git a/build.gradle b/build.gradle index 935763e..1914558 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,13 @@ buildscript { repositories { google() -// mavenCentral() - maven { url "https://jitpack.io" } + mavenCentral() + maven { url 'https://jitpack.io' } + maven { url 'https://maven.google.com' } maven { url 'https://developer.huawei.com/repo/' } + maven { url 'https://developer.hihonor.com/repo' } maven { url 'https://maven.aliyun.com/repository/central' } - maven { url "https://maven.aliyun.com/repository/jcenter" } + maven { url 'https://maven.aliyun.com/repository/jcenter' } maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/google' } } @@ -17,6 +19,31 @@ buildscript { } allprojects { + configurations.all { + resolutionStrategy { + force 'androidx.constraintlayout:constraintlayout:2.0.4' + force 'androidx.core:core:1.5.0' + + //for targetSdkVersion 29 + force 'androidx.activity:activity:1.2.2' + force 'androidx.lifecycle:lifecycle-livedata:2.3.1' + force 'androidx.lifecycle:lifecycle-livedata-core:2.3.1' + force 'androidx.lifecycle:lifecycle-runtime:2.3.1' + force 'androidx.lifecycle:lifecycle-viewmodel:2.3.1' + force 'androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.1' + force 'androidx.lifecycle:lifecycle-service:2.3.1' + force 'androidx.lifecycle:lifecycle-process:2.3.1' + force 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1' + force 'androidx.savedstate:savedstate:1.1.0' + force 'androidx.profileinstaller:profileinstaller:1.1.0' + force 'androidx.startup:startup-runtime:1.0.0' + force 'androidx.arch.core:core-runtime:2.1.0' + force 'androidx.sqlite:sqlite:2.1.0' + force 'androidx.sqlite:sqlite-framework:2.1.0' + force 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' + } + } + gradle.projectsEvaluated { tasks.withType(JavaCompile) { options.compilerArgs.add('-Xbootclasspath/p:libs/framework.jar') @@ -37,28 +64,9 @@ final String FRAMEWORK_PREBUILTS_DIR = "${ANDROID_TOP}/prebuilts/framework_inter apply plugin: 'com.android.application' apply plugin: 'com.google.protobuf' -//apply plugin: "com.tencent.android.tpns" - android { -// gradle.projectsEvaluated { -// tasks.withType(JavaCompile) { -// Set fileSet = options.bootstrapClasspath.getFiles() -// List newFileList = new ArrayList<>(); -// //JAVA语法,可连续调用,输入参数建议为相对路径 -// newFileList.add(new File("libs/framework.jar")) -// //最后将原始参数添加 -// newFileList.addAll(fileSet) -// options.bootstrapClasspath = files( -// newFileList.toArray() -// ) -// } -// } - - lintOptions { - checkReleaseBuilds false - abortOnError false - } + namespace "com.aoleyun.os" compileSdkVersion COMPILE_SDK buildToolsVersion BUILD_TOOLS_VERSION @@ -76,10 +84,26 @@ android { // 还可以添加 'x86', 'x86_64', 'mips', 'mips64' } + lintOptions { + checkReleaseBuilds false + abortOnError false + } + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + buildFeatures { + dataBinding true + buildConfig true + aidl true + } + //签名 signingConfigs { zhanRui { @@ -470,9 +494,7 @@ android { debuggable true versionNameSuffix "-debug" minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - //Zipalign优化 - zipAlignEnabled true + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' signingConfig signingConfigs.mtk applicationVariants.all { variant -> variant.outputs.each { output -> @@ -487,13 +509,8 @@ android { release { buildConfigField "String", "platform", '"MTK"' - //混淆 minifyEnabled false - //前一部分代表系统默认的android程序的混淆文件,该文件已经包含了基本的混淆声明,后一个文件是自己的定义混淆文件 - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - //Zipalign优化 - zipAlignEnabled true - //签名 + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' signingConfig signingConfigs.mtk //将release版本的包名重命名,加上版本及日期 applicationVariants.all { variant -> @@ -508,11 +525,6 @@ android { } } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - // The flavor dimensions for build variants (e.g. aospWithQuickstep, aospWithoutQuickstep) // See: https://developer.android.com/studio/build/build-variants#flavor-dimensions flavorDimensions "app", "recents" @@ -618,12 +630,17 @@ android { repositories { maven { url "../../../prebuilts/fullsdk-darwin/extras/android/m2repository" } maven { url "../../../prebuilts/fullsdk-linux/extras/android/m2repository" } + google() mavenCentral() - maven { url "https://jitpack.io" } - maven { url 'http://developer.huawei.com/repo/' } - maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' } - maven { url 'http://maven.aliyun.com/nexus/content/repositories/releases/' } + maven { url 'https://jitpack.io' } + maven { url 'https://maven.google.com' } + maven { url 'https://developer.huawei.com/repo/' } + maven { url 'https://developer.hihonor.com/repo' } + maven { url 'https://maven.aliyun.com/repository/central' } + maven { url 'https://maven.aliyun.com/repository/jcenter' } + maven { url 'https://maven.aliyun.com/repository/public' } + maven { url 'https://maven.aliyun.com/repository/google' } } dependencies { @@ -668,7 +685,7 @@ dependencies { //磁盘缓存 implementation 'com.jakewharton:disklrucache:2.0.2' //mmkv - implementation 'com.tencent:mmkv-static:1.2.13' + implementation 'com.tencent:mmkv-static:2.4.0' // //腾讯移动推送 TPNS // implementation 'com.tencent.tpns:tpns:1.3.2.0-release' // //阿里云推送 @@ -677,31 +694,19 @@ dependencies { implementation 'me.laoyuyu.aria:core:3.8.16' annotationProcessor 'me.laoyuyu.aria:compiler:3.8.16' //工具类 - implementation 'com.blankj:utilcodex:1.31.0' + implementation 'com.blankj:utilcodex:1.31.1' // 吐司框架:https://github.com/getActivity/Toaster implementation 'com.github.getActivity:Toaster:12.6' } -preBuild { - doLast { - def imlFile = file(project.name + ".iml") - println 'Change ' + project.name + '.iml order' - try { - def parsedXml = (new XmlParser()).parse(imlFile) - def jdkNode = parsedXml.component[1].orderEntry.find { it.'@type' == 'jdk' } - parsedXml.component[1].remove(jdkNode) - def sdkString = "Android API " + android.compileSdkVersion.substring("android-".length()) + " Platform" - println 'what' + sdkString - new Node(parsedXml.component[1], 'orderEntry', ['type': 'jdk', 'jdkName': sdkString, 'jdkType': 'Android SDK']) - groovy.xml.XmlUtil.serialize(parsedXml, new FileOutputStream(imlFile)) - } catch (FileNotFoundException e) { - // nop, iml not found - println "no iml found" - } +// 在 dependencies 之后添加 +project.afterEvaluate { + android.applicationVariants.all { variant -> + variant.javaCompileProvider.get().options.bootstrapClasspath = files( + file('libs/framework.jar'), + android.getBootClasspath() + ) } - //https://www.pianshen.com/article/93481144911/ - //https://blog.csdn.net/dhl_1986/article/details/102856026 - //使用系统编译后的framework.jar } protobuf { diff --git a/gradle.properties b/gradle.properties index a4831f6..349e4a5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,10 +4,10 @@ android.enableJetifier = true ANDROID_X_VERSION=1.0.0-beta01 -GRADLE_CLASS_PATH=com.android.tools.build:gradle:3.3.0 +GRADLE_CLASS_PATH=com.android.tools.build:gradle:8.13.2 -PROTOBUF_CLASS_PATH=com.google.protobuf:protobuf-gradle-plugin:0.8.8 +PROTOBUF_CLASS_PATH=com.google.protobuf:protobuf-gradle-plugin:0.9.4 PROTOBUF_DEPENDENCY=com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-7 -BUILD_TOOLS_VERSION=28.0.3 +BUILD_TOOLS_VERSION=36.0.0 COMPILE_SDK=android-29 \ No newline at end of file diff --git a/iconloaderlib/build.gradle b/iconloaderlib/build.gradle index 3321424..bf4f125 100644 --- a/iconloaderlib/build.gradle +++ b/iconloaderlib/build.gradle @@ -1,6 +1,8 @@ apply plugin: 'com.android.library' android { + namespace "com.aoleyun.os.icons" + compileSdkVersion COMPILE_SDK buildToolsVersion BUILD_TOOLS_VERSION publishNonDefault true