-
Notifications
You must be signed in to change notification settings - Fork 18k
x/mobile: Gradle version > 3.5.1 produces NullPointerException in GobindPlugin #21594
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
Comments
I am a bit puzzled by the line numbers in the NullPointerException (GobindPlugin.groovy:219). |
That's almost correct - the plugin was working on Android Studio 3.0. What caused the breakage was being forced to update the Gradle version from 3.5.1 to 4.1.x |
Hello, I am stuck on the same issue (NullPointerException at GobindPlugin.groovy:219), and this doesn't seem to be related with the Gradle version (I am reproducing it with Gradle 3.5). What feels really strange is that I am using the gomobile plugin v0.2.9 and this is supposed to be fixed by @eliasnaur in this commit.
Out of curiosity, I opened and decompiled my
This really looks like the groovy code before the fix... According to the history the 0.2.9 version is supposed to include the fix. But is there any possibility that the wrong source code version was shipped and tagged as 0.2.9 ? |
/CC @hyangah |
same problem
Erro info:
|
Same problem
|
I've copied the plugin source to buildSrc directory of the Android bind example And the build succeeded. |
Hello @hyangah, this issue is making it impossible to build gomobile apps out of the box, which is pretty problematic... I was trying to sell some coworkers on gomobile, and the result was instead, "sorry, it seems like gomobile is not working and/or not supported right now". CC @broady who might be able to find the right person for this after vacation. |
Confirming that the plugin source copy fix worked. To be specific, copying from golang.org/x/mobile/misc/androidstudio/src/main to golang.org/x/mobile/example/bind/android/buildSrc/src/main. Also had to remove the existing plugin line specifying the gobind plugin, and add a new line, outside the plugins section, reading "apply plugin: 'org.golang.mobile.bind'". Which got me to lint failures, papered over by adding the suggested don't-abort-on-failure stanza to app/build.gradle. (Does not work in build.gradle or hello/build.gradle.) And with that, I was able to get the thing to compile. Yayyy. |
That's correct. As it says in golang.org/x/mobile/README, "The Go Mobile project is experimental. Use this at your own risk. While we are working hard to improve it, neither Google nor the Go team can provide end-user support." You have probably also noticed that there's very little activity in this repo recently from people at Google. We are focused on other things, although we're very grateful for the community work that has gone into keeping x/mobile working as we've stepped back, especially from @eliasnaur. While working on the compilers and standard library, we do continue to pay attention to keeping the mobile builders happy. If there's some approval or something needed here, we can easily do that. It looks instead to me like code changes are needed but not yet written. CLs are welcome, but those of us at Google are not likely to get to this specific issue ourselves. Thanks. |
@Qheb commented on 22 Sep 2017 that the plugin pushed to the distribution website does not match the code pushed to git. That is the correct diagnosis, and now what we need is someone from the Go team with the rights to push a new copy of the plugin to do that. |
I am working on it to push but I am struggling with verifying the newly built plugin working with the newly installed android studio. Can anyone check if https://plugins.gradle.org/plugin/org.golang.mobile.bind.canary is working? |
The latest error I got after updating the golang.org/x/mobile/example/bind/android
Unable to resolve dependency for ':app@debug/compileClasspath': Failed to transform file 'hello.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform Failed to transform file 'hello.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform > java.io.FileNotFoundException: /usr/local/google/home/hakim/go/src/golang.org/x/mobile/example/bind/android/hello/hello.aar (No such file or directory) > /usr/local/google/home/hakim/go/src/golang.org/x/mobile/example/bind/android/hello/hello.aar (No such file or directory) The aar file the gobindplugin explects is not there. |
Even though Android Studio is complaining about gradle project sync failure, build seems to be working. So I will just push it as 0.2.10 and hope the gradle sync failure warning issue seperately. Many little bits in the bind example are outdated and need to be updated. I will file bugs for records. We need help to update the examples and the plugin code. |
Change https://golang.org/cl/86775 mentions this issue: |
Change https://golang.org/cl/86795 mentions this issue: |
In addition to changing the Go plugin to 0.2.10, I found that I needed to downgrade gradle to 2.10 to make it work, because of this error: https://stackoverflow.com/questions/37655814/gradle-sync-failed-unable-to-find-method |
0.2.9 was broken - for unknown reasons, the plugin was built on top of stale sources. Updates golang/go#21594 Plugin 0.2.10 was built with rev 50b7067 and this change. % docker run --rm -u root -v "$PWD":/home/gradle/project \ -w /home/gradle/project gradle:latest \ gradle publishPlugins Gradle version is 4.0.1. Change-Id: I146dc67cbad3c9945a2acdf4ac7993283725090a Reviewed-on: https://go-review.googlesource.com/86775 Reviewed-by: Elias Naur <elias.naur@gmail.com>
Also, modernize the build.gradle configurations to work with recent Android plugin (>=3.0.0) https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html Update golang/go#21594 Change-Id: Ic2162db7367b60ad873149ab62767f36481fa80f Reviewed-on: https://go-review.googlesource.com/86795 Reviewed-by: Elias Naur <elias.naur@gmail.com>
Is this still a problem with the plugin version 0.2.10? If not, please close this issue. |
The plugin is gone from gomobile. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.8
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?linux (Ubuntu) / amd64
What did you do?
Android Studio 3.0 forced an update to Gradle plugin from 3.5.1 to 4.1x.
If possible, provide a recipe for reproducing the error.
Create an Android Studio project and add a module that uses the Gobind plugin (version 0.2.9)
Attempt to build the project
What did you expect to see?
Android Studio / Gradle should build an .aar from the Go source.
What did you see instead?
The plugin produces the following stacktrace:
FAILURE: Build failed with an exception.
Execution failed for task ':agent:gobind'.
> Cannot get property 'classpath' on null object
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':agent:gobind'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.NullPointerException: Cannot get property 'classpath' on null object
at org.golang.mobile.GomobileTask.gomobile(GobindPlugin.groovy:219)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:141)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:731)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:705)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
... 27 more
The text was updated successfully, but these errors were encountered: