Skip to content

Please add protobuf setting changes to get it build on Apple Silicon M1 #396

@y60yu1ii

Description

@y60yu1ii

Describe the bug
There is an issue of protobuf that it does not get the correct artifact name, which cause the plugin does not build to Android on Apple silicon M1

To Reproduce

  1. Add package to the project.
  2. Build & Run on Android.
  3. You would see

* What went wrong:
Execution failed for task ':reactive_ble_mobile:generateDebugProto'.
> Could not resolve all files for configuration ':reactive_ble_mobile:protobufToolsLocator_protoc'.
   > Could not find protoc-3.13.0-osx-aarch_64.exe (com.google.protobuf:protoc:3.13.0).
     Searched in the following locations:
         https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.13.0/protoc-3.13.0-osx-aarch_64.exe

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 6s
Exception: Gradle task assembleDebug failed with exit code 1

Expected behavior
it builds

Smartphone / tablet

  • Device: Pixel2
  • OS: Android 10
  • Package version: 3.3.1+1, 4.0.0, 4.0.1

Peripheral device

Additional context
Please made the following changes to the gradle file.

protobuf {
    protoc {
        // a fix for m1
        if (osdetector.os == "osx") {
            artifact = 'com.google.protobuf:protoc:3.13.0:osx-x86_64'
        } else {
            artifact = 'com.google.protobuf:protoc:3.13.0'
        }
    }

    generateProtoTasks {
        all().each { task ->
            task.builtins {
                java {
                    option "lite"
                }
            }
        }
    }
}

Metadata

Metadata

Assignees

Labels

AndroidAndroid-specific ticket

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions