Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Build on M1 Mac #166

Open
crypto-nerd-88 opened this issue May 2, 2022 · 1 comment
Open

Cannot Build on M1 Mac #166

crypto-nerd-88 opened this issue May 2, 2022 · 1 comment

Comments

@crypto-nerd-88
Copy link

After installing Flutter and Gradle 6, successfully running flutter doctor, and installing NDK V21.1.6352462, I run:

flutter build apk

as per the instructions in the README, I get the following error:

Execution failed for task ':barcode_scan:generateReleaseProto'.
> Could not resolve all files for configuration ':**barcode_scan**:protobufToolsLocator_protoc'.
   > Could not find protoc-3.11.4-osx-aarch_64.exe (com.google.protobuf:protoc:3.11.4).
     Searched in the following locations:
         https://jcenter.bintray.com/com/google/protobuf/protoc/3.11.4/protoc-3.11.4-osx-aarch_64.exe

I even tried forking barcode_scan and changing some things according to some stackoverflow posts, but to no avail.

https://github.com/crypto-nerd-88/flutter_barcode_reader/blob/master/android/build.gradle

The protoc-gen-javalite causes issues and the jcenter repo no longer exists. Maybe you would consider using a different more modern qr scanner dependency??

Any plans on updating this repo so it can work with M1 Macs? It does work on an Intel Mac, BTW.

@hoanghn418
Copy link

hoanghn418 commented May 22, 2022

@crypto-nerd-88
Changing protoc & protoc-gen-javalite in build.gradle work for me.

// Configure the protoc executable
  protoc {
      // Download from repositories
      // For apple m1, add protoc_platform=osx-x86_64 in $HOME/.gradle/gradle.properties
      if (project.hasProperty('protoc_platform')) {
          artifact = "com.google.protobuf:protoc:3.11.4:${protoc_platform}"
      } else {
          artifact = "com.google.protobuf:protoc:3.11.4"
      }
  }
  plugins {
      javalite {
          // The codegen for lite comes as a separate artifact
          if (project.hasProperty('protoc_platform')) {
              artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0:${protoc_platform}"
          } else {
              artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0"
          }
      }
  }

Also add protoc_platform=osx-x86_64 in $HOME/.gradle/gradle.properties

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants