build: upgrade build.gradle to run in Android Studio panda 4
This commit is contained in:
@@ -3,6 +3,8 @@ apply plugin: 'com.android.library'
|
|||||||
|
|
||||||
version = "1.3.3"
|
version = "1.3.3"
|
||||||
android {
|
android {
|
||||||
|
namespace 'com.flyco.tablayout'
|
||||||
|
|
||||||
compileSdkVersion 28
|
compileSdkVersion 28
|
||||||
buildToolsVersion "28.0.3"
|
buildToolsVersion "28.0.3"
|
||||||
|
|
||||||
|
|||||||
129
app/build.gradle
129
app/build.gradle
@@ -5,23 +5,11 @@ static def appName() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static def releaseTime() {
|
static def releaseTime() {
|
||||||
return new Date().format("yyyyMMdd-HHmmss", TimeZone.getDefault())
|
return new Date().format("yyyyMMdd_HHmmss", TimeZone.getDefault())
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
// gradle.projectsEvaluated {
|
namespace "com.fuying.sn"
|
||||||
// tasks.withType(JavaCompile) {
|
|
||||||
// Set<File> fileSet = options.bootstrapClasspath.getFiles()
|
|
||||||
// List<File> newFileList = new ArrayList<>();
|
|
||||||
// //JAVA语法,可连续调用,输入参数建议为相对路径
|
|
||||||
// newFileList.add(new File("libs/framework.jar"))
|
|
||||||
// //最后将原始参数添加
|
|
||||||
// newFileList.addAll(fileSet)
|
|
||||||
// options.bootstrapClasspath = files(
|
|
||||||
// newFileList.toArray()
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
compileSdkVersion 29
|
compileSdkVersion 29
|
||||||
buildToolsVersion "29.0.3"
|
buildToolsVersion "29.0.3"
|
||||||
@@ -39,25 +27,24 @@ android {
|
|||||||
// 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
|
// 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
checkReleaseBuilds false
|
||||||
|
// Or, if you prefer, you can continue to check for errors in release builds,
|
||||||
|
// but continue the build even when errors are found:
|
||||||
|
abortOnError false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
|
|
||||||
javaCompileOptions {
|
buildFeatures {
|
||||||
annotationProcessorOptions {
|
dataBinding true
|
||||||
includeCompileClasspath true
|
buildConfig true
|
||||||
}
|
aidl true
|
||||||
}
|
|
||||||
|
|
||||||
lintOptions {
|
|
||||||
checkReleaseBuilds false
|
|
||||||
}
|
|
||||||
|
|
||||||
dataBinding {
|
|
||||||
enabled true
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//多版本
|
//多版本
|
||||||
@@ -460,14 +447,6 @@ android {
|
|||||||
zipAlignEnabled true
|
zipAlignEnabled true
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
signingConfig signingConfigs.mtk
|
signingConfig signingConfigs.mtk
|
||||||
applicationVariants.all { variant ->
|
|
||||||
variant.outputs.each { output ->
|
|
||||||
if (outputFile != null) {
|
|
||||||
def fileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${buildType.name}.apk"
|
|
||||||
output.outputFileName = fileName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
release {
|
release {
|
||||||
@@ -480,28 +459,28 @@ android {
|
|||||||
//混淆
|
//混淆
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
//前一部分代表系统默认的android程序的混淆文件,该文件已经包含了基本的混淆声明,后一个文件是自己的定义混淆文件
|
//前一部分代表系统默认的android程序的混淆文件,该文件已经包含了基本的混淆声明,后一个文件是自己的定义混淆文件
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
//签名
|
//签名
|
||||||
signingConfig signingConfigs.mtk
|
signingConfig signingConfigs.mtk
|
||||||
// 将release版本的包名重命名,加上版本及日期
|
|
||||||
applicationVariants.all { variant ->
|
|
||||||
variant.outputs.each { output ->
|
|
||||||
def outputFile = ""
|
|
||||||
if (outputFile != null) {
|
|
||||||
def fileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${buildType.name}.apk"
|
|
||||||
output.outputFileName = new File(outputFile, fileName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lintOptions {
|
// Add application variant configuration here instead
|
||||||
checkReleaseBuilds false
|
applicationVariants.all { variant ->
|
||||||
// Or, if you prefer, you can continue to check for errors in release builds,
|
variant.outputs.each { output ->
|
||||||
// but continue the build even when errors are found:
|
def buildType = variant.buildType.name
|
||||||
abortOnError false
|
def fileName = ""
|
||||||
|
|
||||||
|
if (buildType.contains("debug")) {
|
||||||
|
fileName = "${appName()}_V${defaultConfig.versionName}_${releaseTime()}.apk"
|
||||||
|
} else {
|
||||||
|
fileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${buildType}.apk"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output.outputFileName = fileName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -581,23 +560,33 @@ dependencies {
|
|||||||
implementation 'com.github.getActivity:Toaster:12.6'
|
implementation 'com.github.getActivity:Toaster:12.6'
|
||||||
}
|
}
|
||||||
|
|
||||||
preBuild {
|
// 在 dependencies 之后添加
|
||||||
doLast {
|
project.afterEvaluate {
|
||||||
def imlFile = file(project.name + ".iml")
|
android.applicationVariants.all { variant ->
|
||||||
println 'Change ' + project.name + '.iml order'
|
variant.javaCompileProvider.get().options.bootstrapClasspath = files(
|
||||||
try {
|
file('libs/framework.jar'),
|
||||||
def parsedXml = (new XmlParser()).parse(imlFile)
|
android.getBootClasspath()
|
||||||
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"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//https://www.pianshen.com/article/93481144911/
|
|
||||||
//使用系统编译后的framework.jar
|
//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"
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// //https://www.pianshen.com/article/93481144911/
|
||||||
|
// //使用系统编译后的framework.jar
|
||||||
|
//}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class InfoDialog extends Dialog {
|
|||||||
private InfoDialog mDialog;
|
private InfoDialog mDialog;
|
||||||
|
|
||||||
public Builder(Context context) {
|
public Builder(Context context) {
|
||||||
mDialog = new InfoDialog(context, R.style.Theme_AppCompat_Dialog);
|
mDialog = new InfoDialog(context, R.style.CustomDialog);
|
||||||
LayoutInflater inflater =
|
LayoutInflater inflater =
|
||||||
(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
//加载布局文件
|
//加载布局文件
|
||||||
|
|||||||
38
build.gradle
38
build.gradle
@@ -1,19 +1,22 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
|
ext.kotlin_version = '2.3.21'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
// mavenCentral()
|
mavenCentral()
|
||||||
maven { url "https://jitpack.io" }
|
maven { url 'https://jitpack.io' }
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
maven { url 'https://developer.huawei.com/repo/' }
|
maven { url 'https://developer.huawei.com/repo/' }
|
||||||
maven { url 'https://developer.hihonor.com/repo' }
|
maven { url 'https://developer.hihonor.com/repo' }
|
||||||
maven { url 'https://maven.aliyun.com/repository/central' }
|
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/public' }
|
||||||
maven { url 'https://maven.aliyun.com/repository/google' }
|
maven { url 'https://maven.aliyun.com/repository/google' }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.6.4'
|
classpath 'com.android.tools.build:gradle:8.13.2'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
@@ -21,17 +24,38 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
|
configurations.all {
|
||||||
|
resolutionStrategy {
|
||||||
|
force 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||||
|
force 'androidx.annotation:annotation:1.1.0'
|
||||||
|
|
||||||
|
//for targetSdkVersion 29
|
||||||
|
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.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'
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
// mavenCentral()
|
mavenCentral()
|
||||||
maven { url "https://jitpack.io" }
|
maven { url 'https://jitpack.io' }
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
maven { url 'https://developer.huawei.com/repo/' }
|
maven { url 'https://developer.huawei.com/repo/' }
|
||||||
maven { url 'https://developer.hihonor.com/repo' }
|
maven { url 'https://developer.hihonor.com/repo' }
|
||||||
maven { url 'https://maven.aliyun.com/repository/central' }
|
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/public' }
|
||||||
maven { url 'https://maven.aliyun.com/repository/google' }
|
maven { url 'https://maven.aliyun.com/repository/google' }
|
||||||
}
|
}
|
||||||
|
|
||||||
gradle.projectsEvaluated {
|
gradle.projectsEvaluated {
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
//设置jar相对包路径或绝对路径
|
//设置jar相对包路径或绝对路径
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip
|
||||||
|
|||||||
Reference in New Issue
Block a user