Fixed
Status Update
Comments
vs...@google.com <vs...@google.com> #2
This is affecting Android 5.0 when applying the android:theme attribute.
Example:
<Button
android:theme="@android:style/Theme.Material"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onLoginEmail"
Clicking on the button throws
java.lang.IllegalStateException: Could not find a method onLoginEmail(View) in the activity class android.view.ContextThemeWrapper for onClick handler on view class android.widget.Button
at android.view.View$1.onClick(View.java:3994)
at android.view.View.performClick(View.java:4756)
at android.view.View$PerformClick.run(View.java:19749)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.NoSuchMethodException: onLoginEmail [class android.view.View]
at java.lang.Class.getMethod(Class.java:664)
at java.lang.Class.getMethod(Class.java:643)
at android.view.View$1.onClick(View.java:3987)
at android.view.View.performClick(View.java:4756)
at android.view.View$PerformClick.run(View.java:19749)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
/>
Example:
<Button
android:theme="@android:style/Theme.Material"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onLoginEmail"
Clicking on the button throws
java.lang.IllegalStateException: Could not find a method onLoginEmail(View) in the activity class android.view.ContextThemeWrapper for onClick handler on view class android.widget.Button
at android.view.View$1.onClick(View.java:3994)
at android.view.View.performClick(View.java:4756)
at android.view.View$PerformClick.run(View.java:19749)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.NoSuchMethodException: onLoginEmail [class android.view.View]
at java.lang.Class.getMethod(Class.java:664)
at java.lang.Class.getMethod(Class.java:643)
at android.view.View$1.onClick(View.java:3987)
at android.view.View.performClick(View.java:4756)
at android.view.View$PerformClick.run(View.java:19749)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
/>
ve...@gmail.com <ve...@gmail.com> #3
Why is this bug obsolete. It's still reproducing in Android 5.0:
This is affecting Android 5.0 when applying the android:theme attribute.
This is affecting Android 5.0 when applying the android:theme attribute.
ve...@gmail.com <ve...@gmail.com> #4
Yes this is still a bug in Lollipop. This is not obsolete.
vs...@google.com <vs...@google.com> #5
I just hit this today on Android 5.0 applying a theme to a button in order for tinting to work. Now I can't use onClick any more.
ve...@gmail.com <ve...@gmail.com> #6
This is my root build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.2'
}
}
Without this I cannot build my project cause of ABS build.gradle.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.2'
}
}
Without this I cannot build my project cause of ABS build.gradle.
wa...@wnemay.com <wa...@wnemay.com> #7
I have the same problem since I upgraded to Android Studio 0.1.9. I did not have this on 0.1.8
wa...@wnemay.com <wa...@wnemay.com> #8
Ok this worked for me. In your root build.gradle script, add:
task assemble{}
task assemble{}
al...@google.com <al...@google.com> #9
There is a misconfiguration in the project. Somebody in this thread, please submit a project that reproduces this issue. I cannot reproduce it. Please help us fix this bug.
wa...@wnemay.com <wa...@wnemay.com> #10
Attached are three build files, each with a comment on the very first line for where they belong in the project.
Before I added task assemble{} I could not get the project to compile with AS 0.1.9 (although, it did with 0.1.8)
Before I added task assemble{} I could not get the project to compile with AS 0.1.9 (although, it did with 0.1.8)
al...@google.com <al...@google.com> #11
Thanks, Wayne. What I think it's going on is some misconfiguration in a Studio project. What we need to help us debug is a whole Studio project that reproduces this issue. If you could please help us with one, it would be great!
wa...@wnemay.com <wa...@wnemay.com> #12
Unfortunately I cant post the project publicly. Where can I email it to?
al...@google.com <al...@google.com> #13
Thanks, Wayne. My e-mail is alruiz at google.com . Please make sure the project does not have any sensitive information from your employer :-)
la...@gmail.com <la...@gmail.com> #14
Same problem, adding task assemble{} also helped.
il...@gmail.com <il...@gmail.com> #15
same problem here, adding task assemble{} also helped.
Thanks
Thanks
pa...@gmail.com <pa...@gmail.com> #16
Adding this, helped me too!
task assemble{}
to root build.gradle
( btw that file contains only this! )
task assemble{}
to root build.gradle
( btw that file contains only this! )
al...@google.com <al...@google.com> #17
It is not a bug. It is a case of misconfigured projects.
First of all, many thanks to the users that kindly provided projects that reproduced this issue. It was a huge help! :-)
This issue shows up because of 2 reasons:
1. An "android" facet added to the root Studio module, when the root module is not supposed to be built. To fix this go to the root .iml file, open it and check if it has this XML element:
<facet type="android" name="Android">
<configuration />
</facet>
If you do, remove it. The only valid case for a root module to have this facet is it meant to be built by Gradle.
2. Studio modules that do not have the "android" facet. This happens when adding Studio modules manually (e.g. through the "Project Structure" dialog.) Studio will try to build all the modules in your projects using Gradle. When Studio finds a module that does not have the "android" facet, it assumes it is a Java library and tries to build it with the default task "assemble".
From our side (Studio,) we can do the following to prevent misconfiguration of projects:
1. A Gradle-aware "Project Structure" dialog that properly updates Gradle and Studio configurations when adding/removing dependencies and modules (in the works right now.)
2. Project structure diagnostics to tell users that the project is somehow misconfigured and propose fixes (we are not currently working on this, but we have discussed it.)
(I cross-posted this comment in this G+ post:https://plus.google.com/u/0/110937808291147673063/posts/49hP3V9GSGe )
I'm closing this bug. If you find that there is another way to reproduce this bug, please let us know.
First of all, many thanks to the users that kindly provided projects that reproduced this issue. It was a huge help! :-)
This issue shows up because of 2 reasons:
1. An "android" facet added to the root Studio module, when the root module is not supposed to be built. To fix this go to the root .iml file, open it and check if it has this XML element:
<facet type="android" name="Android">
<configuration />
</facet>
If you do, remove it. The only valid case for a root module to have this facet is it meant to be built by Gradle.
2. Studio modules that do not have the "android" facet. This happens when adding Studio modules manually (e.g. through the "Project Structure" dialog.) Studio will try to build all the modules in your projects using Gradle. When Studio finds a module that does not have the "android" facet, it assumes it is a Java library and tries to build it with the default task "assemble".
From our side (Studio,) we can do the following to prevent misconfiguration of projects:
1. A Gradle-aware "Project Structure" dialog that properly updates Gradle and Studio configurations when adding/removing dependencies and modules (in the works right now.)
2. Project structure diagnostics to tell users that the project is somehow misconfigured and propose fixes (we are not currently working on this, but we have discussed it.)
(I cross-posted this comment in this G+ post:
I'm closing this bug. If you find that there is another way to reproduce this bug, please let us know.
al...@google.com <al...@google.com> #18
A user has provided a project that reproduces this issue. Reopening it.
wa...@wnemay.com <wa...@wnemay.com> #20
Thanks for looking into this Alex.
al...@google.com <al...@google.com> #21
Thanks, Wayne. It would have been a lot more difficult to fix if I didn't have a reproducible test case. Thank YOU and all the folks that provided test projects!
an...@gmail.com <an...@gmail.com> #23
unfortunately adding the dummy root build script does not work for me, error persists
vl...@gmail.com <vl...@gmail.com> #24
It turns out that you have to include this 'task assemble{}' workaround for all 'root' projects. E.g. when you add ActionBarSherlock as a GIT submodule to your main project, you should also add 'task assemble{}' into build.gradle file in ABS root, as it has a similar structure.
ma...@gmail.com <ma...@gmail.com> #27
I bump into this problem after I upgrade Android Studio to 130.737825. The only fix was to do as suggested in comment #1 .
de...@gmail.com <de...@gmail.com> #28
I also hit this after upgrading to 130.737825. Should be reopened.
al...@google.com <al...@google.com> #29
Look into this page for the right way to fix it: http://tools.android.com/knownissues
Yes, it makes sense to reopen it. It will be fixed in the next release.
Yes, it makes sense to reopen it. It will be fixed in the next release.
al...@google.com <al...@google.com> #30
In 0.2.0 we fixed this issue by having Studio configure projects and modules the correct way. What was missing is cleaning up misconfigured projects. This CL: https://android-review.googlesource.com/62098 does that.
ma...@gmail.com <ma...@gmail.com> #31
[Comment deleted]
ke...@gmail.com <ke...@gmail.com> #32
di...@gmail.com <di...@gmail.com> #33
an...@gmail.com <an...@gmail.com> #34
issue is resolved with latest Studio version 0.2.0 and gradle plugin 0.5
ke...@gmail.com <ke...@gmail.com> #35
I had version 0.2.0 and plugin 0.5.0, but this problem didn't go away until I removed the .idea folder. I had also tried a "Sync with Gradle" as well, to no avail.
sa...@gmail.com <sa...@gmail.com> #37
#7 Comment worked for me
da...@gmail.com <da...@gmail.com> #39
Thanks for your comments, Ken. Like you, version 0.2.0 and plugin 0.5.0 did *NOT* fix the issue. Once I deleted the .idea folder *AND* imported the top level build.gradle file as per your comments #31, sanity was eventually restored. Ughh - not a nice upgrade. Hopefully, the next one will be smoother. ;-)
ge...@gmail.com <ge...@gmail.com> #40
After updating the idle lost the ability to create projects and work with old projects. I've had the worst possible experience. I'm abandoning their use of time. The only solution I see now is eclipse.
I was considering this the best of all idle, but this way I can not use, unfortunately.
I was considering this the best of all idle, but this way I can not use, unfortunately.
al...@google.com <al...@google.com> #41
This should be fixed in 0.2.1.
ad...@gmail.com <ad...@gmail.com> #42
I refactored directory name (not module) from app to DevOps. After a few time I encountered this error. Not only assemple also clean, assemledebug bla, bla tasks not found. But After I rename again to app, Error gone.
pa...@gmail.com <pa...@gmail.com> #43
Still exists in 3.1.2 with buildSrc and included builds.
np...@gmail.com <np...@gmail.com> #44
if you renamed your 'app' directory make sure your settings.gradle file matches what you renamed it too.
Description
OS version: Ubuntu 13.04 x64
Java JRE/JDK version: 1.8.0-ea
Hello, I've a project with multiflavors (not sure if this is affecting) and multiple modules.
I cannot run instrument tests in one of the android-library I'm using cause I'm always getting this in android-studio:
------------------------------------------------
Gradle:
FAILURE: Could not determine which tasks to execute.
* What went wrong:
Task 'assemble' not found in root project 'AppsBuilderProject'.
* Try:
Run gradle tasks to get a list of available tasks.
------------------------------------------------
As suggested in G+ I removed all the "Android" facets from the .iml file of the root project but this did not solve the issue.
i'm not sure which other info you need to sort this out.