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

Build fails for Android on M1 Macs #23

Closed
euriasb opened this issue Feb 7, 2022 · 9 comments
Closed

Build fails for Android on M1 Macs #23

euriasb opened this issue Feb 7, 2022 · 9 comments

Comments

@euriasb
Copy link

euriasb commented Feb 7, 2022

Build fails for Android on M1 Macs with the following error:

Execution failed for task ':flutter_locker:generateDebugProto'.
> Could not resolve all files for configuration ':flutter_locker:protobufToolsLocator_protoc'.
   > Could not find protoc-3.9.1-osx-aarch_64.exe (com.google.protobuf:protoc:3.9.1).
     Searched in the following locations:
         [https://jcenter.bintray.com/com/google/protobuf/protoc/3.9.1/protoc-3.9.1-osx-aarch_64.exe]()

After some googling, the issue is that there are no binaries for M1 Macs, there are however x86 compatible binaries, this github issue explains how to make protobuf select the appropriate binary, I did it locally and it worked successfully.

@tudor07
Copy link

tudor07 commented Feb 15, 2022

I'm having the same problem but the workarounds did not work for me, I'm stuck

@euriasb
Copy link
Author

euriasb commented Feb 15, 2022

I'm having the same problem but the workarounds did not work for me, I'm stuck

The exact thing I do when I test on Android is I just hard code this on the gradle file:

protobuf {
    // Configure the protoc executable
    protoc {
        // Download from repositories
        artifact = 'com.google.protobuf:protoc:3.9.1:osx-x86_64'
    }
    plugins {
        javalite {
            // The codegen for lite comes as a separate artifact
            artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0:osx-x86_64'
        }
    }
    generateProtoTasks {
        all().each { task ->
            task.plugins {
                javalite { }
            }
        }
    }
}

So, just hardcode :osx-x86_64 after the protoc and javalite artifacts.

Hope this helps you @tudor07

@tudor07
Copy link

tudor07 commented Mar 9, 2022

@euriasb unfortuntaly that does not work for me

  • What went wrong:
    A problem occurred evaluating project ':app'.

Could not find method protobuf() for arguments [build_a3bkpzk12frubfik9jilgxszt$_run_closure6@3d992407] on project ':app' of type org.gradle.api.Project.

@tudor07
Copy link

tudor07 commented Mar 9, 2022

@zenled @itsJoKr any chance you can look into this issue?

@zenled
Copy link
Contributor

zenled commented Mar 23, 2022

We are looking into this.

As @euriasb mentioned, the current workaround is to find the .../.pub-cache/hosted/pub.dartlang.org/flutter_locker-2.0.3/android/build.gradle file and chenge the protobuf {... section to:

protobuf {
    // Configure the protoc executable
    protoc {
        // Download from repositories
        artifact = 'com.google.protobuf:protoc:3.9.1:osx-x86_64'
    }
    plugins {
        javalite {
            // The codegen for lite comes as a separate artifact
            artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0:osx-x86_64'
        }
    }
    generateProtoTasks {
        all().each { task ->
            task.plugins {
                javalite { }
            }
        }
    }
}

@tudor07
Copy link

tudor07 commented May 12, 2022

Any updates? I dread testing on Android because of this issue. Everytime I need to test Android I have to disable flutter_locker everywhere in the app. @zenled

@Kundan-Android
Copy link

Any luck on this, above mentioned workaround is not working for me.

@itsJoKr
Copy link
Contributor

itsJoKr commented May 16, 2022

Can you try this until we get out the new version:

  flutter_locker:
      git:
        url: https://github.com/infinum/flutter-plugins-locker
        ref: 781f02ffa14bef819a9ee5d4c9ac98a42cfc9e57

@itsJoKr
Copy link
Contributor

itsJoKr commented May 17, 2022

You can also try 2.0.4 and reopen if it's still issue.

flutter_locker: ^2.0.4

@itsJoKr itsJoKr closed this as completed May 17, 2022
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

5 participants