Last active
February 12, 2022 03:42
-
-
Save AfzalivE/198bd6737099daee7b09ef9441b3fb11 to your computer and use it in GitHub Desktop.
androidx-on-M1-Mac
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This patch allows building androidx-main on a Mac with M1 Apple Silicon. | |
After following the instructions in the repository (https://github.com/androidx/androidx/blob/androidx-main/README.md) | |
to sync the repo, edit the patch below to replace YOUR_JDK_FOLDER_HERE with an arm64 JDK path, then apply this patch. | |
In prebuilts/androidx/external/com/google/protobuf folder, for the dependencies that | |
needs to be updated to version 3.19.4 because it supports aarch64, | |
create a 3.19.4 folder inside their folders. Here are the ones that need updating: | |
. protobuf-bom | |
. protobuf-java | |
. protobuf-java-util | |
. protobuf-javalite | |
. protobuf-parent | |
. protoc | |
Download protobuf dependencies from https://mvnrepository.com one by one and put it in the new 3.19.4 folders for each. | |
After that, you should be able to follow the instructions in Readme.md to do a full build. | |
diff --git a/sqlite/integration-tests/inspection-room-testapp/build.gradle b/sqlite/integration-tests/inspection-room-testapp/build.gradle | |
index 008455153818a0032eb10aa842700c04180c1a01..abe1c7f3b7f0a8c38d78ab2380aac93eccf1abbb 100644 | |
--- a/sqlite/integration-tests/inspection-room-testapp/build.gradle | |
+++ b/sqlite/integration-tests/inspection-room-testapp/build.gradle | |
@@ -31,7 +31,7 @@ dependencies { | |
androidTestImplementation(project(":room:room-runtime")) | |
androidTestImplementation(project(":sqlite:sqlite-inspection")) | |
androidTestImplementation(project(":inspection:inspection-testing")) | |
- androidTestImplementation("com.google.protobuf:protobuf-javalite:3.10.0") | |
+ androidTestImplementation("com.google.protobuf:protobuf-javalite:3.19.4") | |
kaptAndroidTest(project(":room:room-compiler")) | |
} | |
diff --git a/wear/tiles/tiles-renderer/build.gradle b/wear/tiles/tiles-renderer/build.gradle | |
index 50cb5bdaaceb2d2a8dd243c8c75b35771ca61eee..873e70de364c4c7f6a90a4203b46fec0a92fab5e 100644 | |
--- a/wear/tiles/tiles-renderer/build.gradle | |
+++ b/wear/tiles/tiles-renderer/build.gradle | |
@@ -44,7 +44,7 @@ dependencies { | |
androidTestImplementation(libs.testCore) | |
androidTestImplementation(libs.testRunner) | |
androidTestImplementation(libs.testRules) | |
- androidTestImplementation("com.google.protobuf:protobuf-java:3.10.0") | |
+ androidTestImplementation("com.google.protobuf:protobuf-java:3.19.4") | |
// I'm not 100% sure why, but androidTestImplementation doesn't appear to use the standard | |
// results of a project build. This leads to it not using the shadow configuration from | |
@@ -92,7 +92,7 @@ tasks.withType(KotlinCompile).configureEach { | |
protobuf { | |
protoc { | |
- artifact = "com.google.protobuf:protoc:3.10.0" | |
+ artifact = "com.google.protobuf:protoc:3.19.4" | |
} | |
// Generates the java proto-lite code for the protos in this project. See | |
@@ -115,4 +115,3 @@ androidx { | |
description = "Android Wear Tiles Renderer components. These components can be used to parse " + | |
"and render an already constructed Wear Tile." | |
} | |
- | |
diff --git a/gradlew b/gradlew | |
index 73e2b5f5df43aea796377df5ae57d6f5da06a3b1..8f101cc6b91ae23e9db604979dfce47d3c73cde4 100755 | |
--- a/gradlew | |
+++ b/gradlew | |
@@ -120,7 +120,8 @@ DEFAULT_JVM_OPTS="-DLINT_API_DATABASE=$APP_HOME/../../prebuilts/fullsdk-$plat/pl | |
# setup from each lint module. | |
export ANDROID_HOME="$APP_HOME/../../prebuilts/fullsdk-$plat" | |
# override JAVA_HOME, because CI machines have it and it points to very old JDK | |
-export JAVA_HOME="$APP_HOME/../../prebuilts/jdk/jdk11/$plat-x86" | |
+# export JAVA_HOME="$APP_HOME/../../prebuilts/jdk/jdk11/$plat-x86" | |
+export JAVA_HOME="YOUR_JDK_FOLDER_HERE" | |
export JAVA_TOOLS_JAR="$APP_HOME/../../prebuilts/jdk/jdk8/$plat-x86/lib/tools.jar" | |
export STUDIO_GRADLE_JDK=$JAVA_HOME | |
diff --git a/inspection/inspection-gradle-plugin/src/main/kotlin/androidx/inspection/gradle/InspectionPlugin.kt b/inspection/inspection-gradle-plugin/src/main/kotlin/androidx/inspection/gradle/InspectionPlugin.kt | |
index 1ad57b5fcc61bcf965a5f9666ee92becb081b86b..86ae2de055056ab8af8573f31df91033cfd42b97 100644 | |
--- a/inspection/inspection-gradle-plugin/src/main/kotlin/androidx/inspection/gradle/InspectionPlugin.kt | |
+++ b/inspection/inspection-gradle-plugin/src/main/kotlin/androidx/inspection/gradle/InspectionPlugin.kt | |
@@ -98,7 +98,7 @@ class InspectionPlugin : Plugin<Project> { | |
val protobufConvention = project.convention.getPlugin<ProtobufConvention>() | |
protobufConvention.protobuf.apply { | |
protoc { | |
- this.artifact = "com.google.protobuf:protoc:3.10.0" | |
+ this.artifact = "com.google.protobuf:protoc:3.19.4" | |
} | |
generateProtoTasks { | |
all().forEach { task: GenerateProtoTask -> | |
@@ -112,7 +112,7 @@ class InspectionPlugin : Plugin<Project> { | |
} | |
project.dependencies { | |
- add("implementation", "com.google.protobuf:protobuf-javalite:3.10.0") | |
+ add("implementation", "com.google.protobuf:protobuf-javalite:3.19.4") | |
} | |
project.afterEvaluate { | |
diff --git a/sqlite/integration-tests/inspection-sqldelight-testapp/build.gradle b/sqlite/integration-tests/inspection-sqldelight-testapp/build.gradle | |
index 8de9c32f63637ea9def296ae493d2f9902e3fef7..9f5f9146bb94650047249013702351c131d7bcd6 100644 | |
--- a/sqlite/integration-tests/inspection-sqldelight-testapp/build.gradle | |
+++ b/sqlite/integration-tests/inspection-sqldelight-testapp/build.gradle | |
@@ -31,7 +31,7 @@ dependencies { | |
androidTestImplementation(libs.testRunner) | |
androidTestImplementation(project(":sqlite:sqlite-inspection")) | |
androidTestImplementation(project(":inspection:inspection-testing")) | |
- androidTestImplementation("com.google.protobuf:protobuf-javalite:3.10.0") | |
+ androidTestImplementation("com.google.protobuf:protobuf-javalite:3.19.4") | |
} | |
android { | |
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml | |
index 04c0e344d3dbd0f6dbf3281739cb9cd099d47825..e3d0b84e8d43d07a33e51121a047894aa2d5a71e 100644 | |
--- a/gradle/libs.versions.toml | |
+++ b/gradle/libs.versions.toml | |
@@ -145,9 +145,9 @@ playServicesBase = { module = "com.google.android.gms:play-services-base", versi | |
playServicesBasement = { module = "com.google.android.gms:play-services-basement", version = "17.0.0" } | |
playServicesWearable = { module = "com.google.android.gms:play-services-wearable", version = "17.1.0" } | |
protobuf = { module = "com.google.protobuf:protobuf-java", version = "3.4.0" } | |
-protobufCompiler = { module = "com.google.protobuf:protoc", version = "3.10.0" } | |
+protobufCompiler = { module = "com.google.protobuf:protoc", version = "3.19.4" } | |
protobufGradlePluginz = { module = "com.google.protobuf:protobuf-gradle-plugin", version = "0.8.18" } | |
-protobufLite = { module = "com.google.protobuf:protobuf-javalite", version = "3.10.0" } | |
+protobufLite = { module = "com.google.protobuf:protobuf-javalite", version = "3.19.4" } | |
reactiveStreams = { module = "org.reactivestreams:reactive-streams", version = "1.0.0" } | |
retrofit = { module = "com.squareup.retrofit2:retrofit", version = "2.7.2" } | |
robolectric = { module = "org.robolectric:robolectric", version = "4.7.3" } | |
diff --git a/health/health-services-client/build.gradle b/health/health-services-client/build.gradle | |
index a07048e017cb6ef3d6c433fc8a44977852e876b4..f8186761f9eeca585ddeee0aa26b7bbcd00c01e8 100644 | |
--- a/health/health-services-client/build.gradle | |
+++ b/health/health-services-client/build.gradle | |
@@ -30,7 +30,7 @@ dependencies { | |
implementation(libs.guavaListenableFuture) | |
implementation(libs.guavaAndroid) | |
implementation("androidx.core:core-ktx:1.5.0-alpha04") | |
- implementation "com.google.protobuf:protobuf-javalite:3.10.0" | |
+ implementation "com.google.protobuf:protobuf-javalite:3.19.4" | |
} | |
android { | |
@@ -44,7 +44,7 @@ android { | |
protobuf { | |
protoc { | |
- artifact = "com.google.protobuf:protoc:3.10.0" | |
+ artifact = "com.google.protobuf:protoc:3.19.4" | |
} | |
// Generates the java proto-lite code for the protos in this project. See |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment