-
Notifications
You must be signed in to change notification settings - Fork 600
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
[SOLVED] Execution failed for task ':app:compileDebugJavaWithJavac' java.lang.IllegalArgumentException: expected type but was null [UpperCamelCase not documented]] #972
Comments
It looks like it is failing to generate code related to a table field. On Sun, Sep 4, 2016 at 2:57 PM, andrewpros [email protected] wrote:
|
I hadn't changed anything, it is my first time using dbflow in project, so i never had it working, started about 3 hours ago, that is the time i tried fighting with it, but no luck. I had setup the simplest test app possible and still, won't work. Just as in updated issue above, as soon as i add any model configuration with annotations it won't compile. |
Is it a public project? Will be easier if we can see the full consumption On Sep 4, 2016 3:05 PM, "andrewpros" [email protected] wrote:
|
Well no, but i can provide the bare minimum sample project here http://www39.zippyshare.com/v/iMpVdXEG/file.html But it is nothing fancy, so i don't see where i would make a mistake, other libs just works plug and play, so i think it is in the library itself or some software incompatibility? Is there a way i can setup it to debug the the dbflow processor where the issue pops out? |
@trevjonez Ok i have found something, managed to debug the annotation processor, seems like i know why it fails with IllegalArgumentException expected type but was null, but don't know the source of this yet. The first screen, tableClass is null, this is important. Then it goes here, due to tableClasss being null the args don't have a parameter at index 1, only 0 or 2, this code goes from index 0 to max, and don't check if there are some holes And this goes to argToType that throws the error, cuz index 1 is null So i don't know if there is a problem that tableClass is null but it never can be, so need to look why it is null or if the code in CodeBlock add function (screen two) should not iterate from 0 to max args, but check and omit the gaps. Any advice? |
Found the problem. @agrosner It is in getElementClassName that uses JavaPoet ClassName bestGuess method According to bestGuess method documentation
So my table class was not UpperCamelCase compliant BUT DBFlow docs doesn't state that it is necessary and haven't seen any tutorial that states this, so maybe it would be good to update the docs. Well as soon as i make it UpperCamelCase it works, not sure what if i have lower case table name in db, hope table name attribute is sufficient. |
It may be nice to have a sort of FAQ but there may be a better way to handle getting a class name from an element than using toString and bestGuess. The wide use of code block in the processor code gives me the feeling that a good deal of the APT code could be refactored to use the control flow / statement api's of javapoet to be made more safe, and to just let things like that best guess throw with a meaningful error. the advantage of using begin and end control flow is that javapoet can throw an exception if you start an if block and never close it rather than waiting for the output and trying to figure out where the syntax problem is coming from. |
…mediately resolved by classname.get(typeelement). #972
in |
This problem also happens if you have package names that are not all lowercase as well, not just tables that are not upper camel case. The 4.0.0-beta1 fixes this issue regardless. |
Its smart answer is that there is some syntax error in your Code may be in Java file or xml. FIx them error will gone. work 100 percent for me every time |
you need to disabled the next option Instant run app it was functioned to me |
Translate in English Plz |
ready |
you need to run androidstuio as an administrator- worked for me |
DBFlow Version: 3.1.1 or develop snapshot
Bug
Description:
FAILURE: Build failed with an exception.
Execution failed for task ':app:compileDebugJavaWithJavac'.
I have tried EVERYTHING, nothing fixes it, my main app won't compile, made new test app with bare minimum, the same error, newest stable android studio
my gradle
It works with only database configured, but as soon as i add any model configuration with annotations it won't compile with that error, even a bare simple one:
Anyone have an idea, i need this working asap?
The text was updated successfully, but these errors were encountered: