appditto / natrium_wallet_flutter

Natrium - Fast, Robust & Secure NANO Wallet, now written with Flutter.
Other
845 stars 323 forks source link

Cannot Build on M1 Mac #166

Open crypto-nerd-88 opened 2 years ago

crypto-nerd-88 commented 2 years ago

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 commented 2 years ago

@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