1
0
mirror of https://github.com/tateisu/SubwayTooter synced 2025-02-01 19:36:48 +01:00

AGP 8.0.0, Gradle 8.1, JDK17でkspがJava target levelを勘違いする問題の対策

This commit is contained in:
tateisu 2023-04-16 05:23:34 +09:00
parent 8cb7fef71f
commit 49bd10561d
16 changed files with 126 additions and 33 deletions

View File

@ -24,14 +24,24 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility javaSourceCompatibility
targetCompatibility javaTargetCompatibility
}
kotlinOptions {
jvmTarget = kotlinJvmTarget
}
}
kotlin {
jvmToolchain(kotlinJvmToolchain)
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = kotlinJvmTarget
}
}
dependencies {
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxTestExtJunitVersion"

View File

@ -1,13 +1,13 @@
apply plugin: "java-library"
apply plugin: "kotlin"
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = javaSourceCompatibility
targetCompatibility = javaTargetCompatibility
compileKotlin {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = javaSourceCompatibility
targetCompatibility = javaTargetCompatibility
kotlinOptions {
jvmTarget = kotlinJvmTarget

View File

@ -6,8 +6,8 @@ android {
buildToolsVersion stBuildToolsVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility javaSourceCompatibility
targetCompatibility javaTargetCompatibility
}
namespace "jp.juggler.apng"
@ -38,6 +38,16 @@ android {
}
}
kotlin {
jvmToolchain(kotlinJvmToolchain)
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = kotlinJvmTarget
}
}
repositories {
mavenCentral()
}

View File

@ -23,8 +23,8 @@ android {
// exoPlayer 2.9.0 Java 8 compiler support
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility javaSourceCompatibility
targetCompatibility javaTargetCompatibility
coreLibraryDesugaringEnabled true
}
@ -42,6 +42,7 @@ android {
buildFeatures {
viewBinding true
buildConfig true
}
kotlinOptions {
@ -150,6 +151,16 @@ android {
}
kotlin {
jvmToolchain(kotlinJvmToolchain)
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = kotlinJvmTarget
}
}
static def gitBranch() {
def branch = "(no branch)"
def proc = "git status".execute()

View File

@ -484,7 +484,7 @@ fun AppCompatActivity.setStatusBarColor(forceDark: Boolean = false) {
var c = when {
forceDark -> Color.BLACK
else -> PrefI.ipStatusBarColor.value.notZero()
?: attrColor(R.attr.colorPrimaryDark)
?: attrColor(android.R.attr.colorPrimaryDark)
}
setStatusBarColorCompat(c)

View File

@ -144,7 +144,7 @@ fun Activity.openCustomTab(url: String?) {
CustomTabsIntent.Builder()
.setDefaultColorSchemeParams(
CustomTabColorSchemeParams.Builder()
.setToolbarColor(attrColor(R.attr.colorPrimary))
.setToolbarColor(attrColor(android.R.attr.colorPrimary))
.build()
)
.setShowTitle(true)

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- ビューのタグのキーに使うID -->
<item type="id" name="text" />
</resources>

View File

@ -15,6 +15,10 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
buildConfig true
}
buildTypes {
release {
minifyEnabled false
@ -23,8 +27,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility javaSourceCompatibility
targetCompatibility javaTargetCompatibility
coreLibraryDesugaringEnabled true
}
@ -41,6 +45,16 @@ android {
}
}
kotlin {
jvmToolchain(kotlinJvmToolchain)
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = kotlinJvmTarget
}
}
dependencies {
// desugar_jdk_libs 2.0.0 AGP 7.4.0-alpha10
//noinspection GradleDependency

View File

@ -5,7 +5,6 @@ import io.github.inflationx.calligraphy3.CalligraphyConfig
import io.github.inflationx.calligraphy3.CalligraphyInterceptor
import io.github.inflationx.calligraphy3.CalligraphyTypefaceSpan
import io.github.inflationx.viewpump.ViewPump
import jp.juggler.base.R
fun initializeFont() {
ViewPump.init(
@ -13,7 +12,9 @@ fun initializeFont() {
.addInterceptor(
CalligraphyInterceptor(
CalligraphyConfig.Builder()
.setFontAttrId(R.attr.fontPath)
// AGP8で参照するRクラスが分割されてエラーになる。
// 指定する必要もないと思う…
// .setFontAttrId(R.attr.fontPath)
.build()
)
)

View File

@ -10,12 +10,15 @@ buildscript {
ext.composeVersion = "1.0.5"
ext.conscryptVersion = "2.5.2"
ext.conscryptVersion = "2.5.2"
ext.coreKtxVersion = "1.9.0"
ext.coreKtxVersion = "1.10.0"
ext.desugarLibVersion = "1.2.0"
ext.detektVersion = "1.22.0"
ext.glideVersion = "4.14.2"
ext.javaSourceCompatibility = JavaVersion.VERSION_1_8
ext.javaTargetCompatibility = JavaVersion.VERSION_1_8
ext.junitVersion = "4.13.2"
ext.koinVersion = "3.1.3"
ext.kotlinJvmToolchain = 17
ext.kotlinJvmTarget = "1.8"
ext.kotlinVersion = "1.8.0"
ext.kotlinxCoroutinesVersion = "1.6.4"
@ -34,7 +37,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.android.tools.build:gradle:8.0.0'
// room google-services
classpath "com.google.gms:google-services:4.3.15"

View File

@ -5,6 +5,12 @@ android {
compileSdkVersion stCompileSdkVersion
buildToolsVersion stBuildToolsVersion
compileOptions {
sourceCompatibility javaSourceCompatibility
targetCompatibility javaTargetCompatibility
coreLibraryDesugaringEnabled true
}
defaultConfig {
targetSdkVersion stTargetSdkVersion
minSdkVersion stMinSdkVersion
@ -12,14 +18,9 @@ android {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
namespace 'com.jrummyapps.android.colorpicker'
resourcePrefix "cpv_"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
coreLibraryDesugaringEnabled true
}
kotlinOptions {
jvmTarget = kotlinJvmTarget
freeCompilerArgs += [
@ -33,7 +34,16 @@ android {
lint {
abortOnError false
}
namespace 'com.jrummyapps.android.colorpicker'
}
kotlin {
jvmToolchain(kotlinJvmToolchain)
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = kotlinJvmTarget
}
}
dependencies {

View File

@ -6,8 +6,8 @@ android {
buildToolsVersion stBuildToolsVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility javaSourceCompatibility
targetCompatibility javaTargetCompatibility
}
defaultConfig {
@ -28,3 +28,13 @@ android {
}
namespace 'jp.juggler.emoji'
}
kotlin {
jvmToolchain(kotlinJvmToolchain)
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = kotlinJvmTarget
}
}

View File

@ -29,5 +29,4 @@ android.useAndroidX=true
android.enableJetifier=true
android.debug.obsoleteApi=true
# generate signed APK するときにエラーを出すことがある
org.gradle.unsafe.configuration-cache=false

View File

@ -1,6 +1,6 @@
#Mon Jun 13 20:53:58 JST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

View File

@ -21,10 +21,20 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility javaSourceCompatibility
targetCompatibility javaTargetCompatibility
}
kotlinOptions {
jvmTarget = kotlinJvmTarget
}
}
kotlin {
jvmToolchain(kotlinJvmToolchain)
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = kotlinJvmTarget
}
}

View File

@ -6,8 +6,8 @@ android {
buildToolsVersion stBuildToolsVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility javaSourceCompatibility
targetCompatibility javaTargetCompatibility
}
defaultConfig {
@ -48,6 +48,16 @@ android {
namespace 'jp.juggler.apng.sample'
}
kotlin {
jvmToolchain(kotlinJvmToolchain)
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = kotlinJvmTarget
}
}
dependencies {
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$desugarLibVersion"
implementation project(":base")