Open AndroidDeveloperLB opened 7 years ago
No idea, when I updated to 2.3.0 on macOS a couple days ago it worked fine. What is the full error output? Does it fail if you build from the command line instead of in Android Studio? Did you also upgrade to Android Studio 2.3.0 and gradle 3.3 when you updated the gradle plugin?
Update: we had a user report in our gitter chat a similar issue that they resolved by upgrading from using the android-apt
plugin to using annotationProcessor
. If you're still using android-apt
, you might try upgrading to see if that fixes your problem. Instructions can be found here: https://bitbucket.org/hvisser/android-apt/wiki/Migration
Looks like that migration page for android-apt
has been updated since I last read it. It now notes: "Android Gradle 2.3 is actively blocking android-apt now in anticipation of upcoming changes to the Android Gradle plugin. This means that android-apt is officially obsolete." So if you are still using android-apt
, the upgrade will definitely be necessary.
I've searched the entire project for "android-apt" and there is none of it. Instead, we have this:
//used for squidb: https://github.com/yahoo/squidb/issues/263 https://github.com/yahoo/squidb/wiki/Taking-control-of-code-generation
javaCompileOptions {
annotationProcessorOptions {
arguments = [
squidbOptions: 'androidModels'
]
}
}
About the upgrade, at first we upgraded the IDE in the normal way, but since it caused the OS to crash and restart when opening the IDE, we fixed it by re-downloading the IDE and installing it on top of what we have. Now the IDE works fine, but the building works only when using the older gradle version.
In that case, that sounds more like an IDE bug than a squidb issue. Have you tried doing a clean build from the command line?
I don't know, because the files of the entities really don't exist, and it worked fine on Windows OS... What should I write in the terminal for this?
From your project's root directory, or wherever your gradle wrapper is located:
./gradlew clean assembleDebug
.
Also, what gradle version are you using?
How do you check the gradle version on MacOS (I use Windows) ? Doesn't it already have the latest version when installing the IDE ?
The IDE doesn't necessarily control the gradle version, it all depends on how you've configured your project. Most people use the gradle wrapper, which defines the gradle version on a per-project basis in gradle/wrapper/gradle-wrapper.properties
(you can see where squidb defines it here). I don't know whether or not your project is configured to use the gradle wrapper, so I can't tell you how to get the gradle version or update it, but this stack overflow answer might help. I believe that the latest android gradle plugin requires gradle version 3.3 or higher, so make sure you've updated to at least that version.
Did you try building from the command line like I suggested?
We checked in "gradle/wrapper/gradle-wrapper.properties" , and it's 3.3 . About running from command line, we needed to write "bash" before. It said "build successful", but when we tried to run, it still got the same issue. But even if it works, this is not the way we intend to work with. Using the IDE is the most comfortable way.
Understood, but if it works when building from the command line, the issue is almost certainly with Android Studio, not with SquiDB. The SquiDB code generator is just an annotation processor; it's the responsibility of the build tools to make sure that any code generated by annotation processors are picked up and compiled correctly. Since it works from the command line, this suggests that the SquiDB annotation processor is fine.
It may be that something is misconfigured in your Android Studio settings, or it may be a bug in Android Studio 2.3 itself. I'd recommend clearing out Android Studio's caches, or even uninstalling and reinstalling it completely (you can find instructions for how to do these things on google). If the problem persists, I'd recommend that you a small sample project that duplicates the issue and filing a bug with the Android Studio team. Unless there is anything specific that makes you think this IS a SquiDB bug?
Does "./gradlew clean assembleDebug" actually prepares an APK ? What exactly in the IDE should be changed? It has a lot of settings that were set.
assembleDebug
prepares a debug APK, which is generally the same as what happens when you hit the "Run" button in the IDE (unless you've configured the IDE otherwise).
As for whether or not some setting in your IDE needs to be changed I'm afraid can't help you there, since as I mentioned we were unable to reproduce the problem ourselves -- the squidb tests and sample project go through code generation and build without errors when using studio + gradle plugin 2.3 on mac. You'll have to do some debugging to try and figure out what's different between your Mac and Windows setups. If you become confident that the mac version of studio is just misbehaving, you can try to get support from the android studio team, or if you get more information suggesting that it IS a squidb problem (or if we or any other community member manage to reproduce the issue), you can report that back here.
We have a large project that uses this library. SO far it worked fine on both Windows and MacOS, while using the gradle plugin:
classpath 'com.android.tools.build:gradle:2.2.3'
But, today, when we updated to the new version :
classpath 'com.android.tools.build:gradle:2.3.0'
for some reason, only on MacOS, it failed to find even one generated entity. Re-building the project didn't help. All this, while on Windows OS it works fine.
How come?