I'm using an annotation processor to generate code in android studio and ran into t
he problem that with every build android studio re-adds (i manually delete it every now and then) the following line to the module's .iml file:
<excludeFolder url="file://$MODULE_DIR$/build/source" />
Does anyone know a setting or a way to prevent this?
I'm maybe thinking of a gradle task to delete this line from the file but i've never done anything like this. Can someone point me to the right direction?
I'm using the latest android studio version in beta update channel, which is 0.8.2
Thanks in advance!
EDIT: Just to clarify: everything builds fine, but android studio shows a lot of errors in the editor and i can't use functions like "find usages" and "jump to definition" properly.
Thanks for guiding me in the right direction, the answer is to use a different source folder or in my case to update android-apt to a version >= 1.3 in build.gradle, like this:
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3+'
I still had 1.2.+, see this link to the author's git for more details:
https://bitbucket.org/hvisser/android-apt/issue/13/compatibility-with-011-android-plugin
Related
My gradle build completes successfully, but I get:
WARNING: Unsupported Kotlin plugin version.
The `embedded-kotlin` and `kotlin-dsl` plugins rely on features of Kotlin `1.5.31` that
might work differently than in the requested version `1.6.10`.
All of my build.gradle.kts scripts refer to using version 1.5.31. The only association my project has with version 1.6.10 is that Android Studio has the Kotlin version 1.6.10 plugin added. If I try to disable that plugin, I get a message that several other plugins will be disabled. If I accept that, android studio crashes and will not start up again. It won't start up again even if you reinstall android studio again. The solution is to find the file named "disabled-plugins.txt" and delete that file. It's in your AppData folder and in a JetBrains subdirectory. It turns out that it's one or more of those other disabled plugins that prevents Android Studio from starting up again.
The question I have is how do I fix this version mismatch issue. I can't delete the plugin from Android Studio for the reasons I mentioned above. If I try to update my project to using version 1.6.10 I get literally 100's of unresolved dependencies. And it seems from opinionated investigation that 1.6.10 still have too many issues for general use.
By the way, when I look at the gradle window for the project I can see where the dependencies come from. Usually when I look at the gradle window I just see sub project folders that I can drill into for more information, but for this project, it has an additional folder name dependencies. I don't know how they get into my project. But when I look at their version numbers that's where the 1.6.10 mismatch happens.
So, I think I understand why the warning message is valid, I'm at a lost on what I need to do to correct this situation. For the moment, I'm just ignoring the warning, and so far I'm not finding any issues in proceeding that way. But that's means I'm proceeding, without an understanding of what's going on here! Sometimes that's okay and at other times that's a bad judgment The error message itself seems inverted. I would think that 1.6.10 is the embedded kotlin and kotlin-dsl since it an android studio plugin, but the error message seems to say it in the opposite way. So anyway, if someone can bring some clarity as to what's going on, and how I'm thinking wrongly about this problem would be greatly appreciated.
I'll accept the following as the answer to what's going on about the unsupported kotlin version:
https://github.com/gradle/gradle/issues/13020
So, for the moment, I'll go on like this is just a nuisance warning and ignore that.
What I just did was to re-create my Android Studio from a blank brand new project. I copied and pasted stuff from the previous project into the new project. I copied the source and build.script.kts files, so essentially everything is a copy of the disabandoned project. This new project didn't give me the WARNING message anymore. And in additional, I'm now able to upgrade my project to using kotlin 1.6.10, which I previously couldn't do because of the literally 100's of dependencies resolution issues. Whatever, that issue went away, and a lot of others things started working as expected once I recreated the project. I can't say what got my project into that weird state. Deleting the .gradle and .idea folders, wouldn't fix the problem. I didn't try deleting the JetBrains cache, I wish I would have tried that.
UPDATE: Solved! (see fix at the bottom)
I'm trying to go through the Android Room tutorial but get stuck on step3. I keep getting an error when trying to update the gradle file as specified by the tutorial.
https://codelabs.developers.google.com/codelabs/android-room-with-a-view/index.html?index=..%2F..index#1
When trying to build, I get the following error:
Setting roomVersion to "2.1.0-alpha06" or just "2.1.0" generates the same type of error.
Is it only me or is there something wrong with this tutorial?
Anyone with an idea why the androidx.room:room-testing dependancy fails to build?
UPDATE:
I solved the issue by uninstalling Android Studio and re-installing it. I also needed to do a full cleanup and remove all "android studio" and "gradle" related files on my system. Maybe a bit overkill, but this is whats fixed it for me.
I am new to Android development, and was wondering why a library like AudioManager (android.media.AudioManager) can be used, but when I try to navigate to the code of AudioManager, half the source code is red.
For example, it says,
cannot resolve symbol SystemService"
Do I need to add some kind of dependency somewhere?
This means that when I debug through AudioManager, the bytecode does not match what appears on the screen and the debug is useless.
I've tried looking at other posts and changing my SDK version to 27 and my minimum version up to 23.
Thanks in advance.
This seems to be an IDE error, typically when I am getting build errors caused by this, Invalidate Caches and Restart will fix this. You can find it by searching in the help menu or under File in Android Studio
You could try below points as it worked-out for it :
Exit Android Studio
Back up your project
Delete all the .iml files and the .idea folder
Relaunch Android Studio and reimport your project
By the way, the error messages you see in the Project Structure dialog are bogus for the most part.
try to update your Android studio, they always working for something like this. I recommend AS 3.3
Thanks to all for trying to answer. I found the answer to my question here: The import android.os.ServiceManager cannot be resolved.
Explanation:
Apparently the reason AudioManager had so many reds is because it depends on many "hidden" classes, that are purposely excluded from the .jar libraries. The #hide in https://github.com/commaai/android_frameworks_base/blob/master/media/java/android/media/IAudioService.aidl is one example.
I upgraded android studio to 2.2.p1 and builded my project without errors. There are some strange borders around views (see att). When I create the new default project and build it in 2.2.p1 the problem is the same. When I do the same in 2.1.1 the app behaviour is normal - without borders. The problem is, that I'm not able to find the cause of this behaviour and build my existing project in 2.1.1 did not help -> there is something "strange" in existing project which was already compiled in 2.2p1. Do you have a idea and solution for this?
thank you for your time and help ... noe
https://code.google.com/p/android/issues/detail?id=210467
I think this is correlated to the bug that is filed.
So long story short, just wait for the fix, OR, downgrade your gradle to
classpath 'com.android.tools.build:gradle:2.1.+'
I have followed the procedure as described here : Setup
I have clicked on the little 'Sync project with Gradle' button. Gradle and Android Studio seem to find everything but then I can't actually use the gms code. If I try to import, I will get autocomplete for com.google.android.gms but no further. I have updated all the packages with Android SDK Manager.
I'm running Android Studio 0.4.2.
My minSdk is set to 9
my build.gradle includes compile 'com.google.android.gms:play-services:4.0.30'
As far as the procedure is concerned I should be ready to code, but it just doesn't work. Any ideas?
[Edit, added info]
I can find the ComGoogleAndroiddGmsPlayServices3265.aar file in my exploded bundles directory. Inside of that file I also find the common directory and inside that I find the GooglePlayServicesUtil.class (which is what's not being found in my app)
I am lost.
[Edit 2]
The problem is not specific to Google Play Services OR Android Studio. I tried adding another library (HoloColorPicker) and had the same results. However, I was able to add the library's resources to my project! I was able to add them in my XML layouts and view them in my application. I was able to interact with them, they worked fine. The problem arose again when I tried to reference them in the code. Exactly like the case with gms, I had code completion when trying to import up to the point of the actual class, and I could not declare the class in the code.
I was able to use the library by cloning it and importing the project.
Also, this is not an Android Studio problem because the same thing happens on the command line with "./gradlew clean build"
This is a current bug in Android Studio: https://code.google.com/p/android/issues/detail?id=64508 to be fixed this week.
The workaround is to close the project, delete the .iml files and .idea project and re-import the project.
Keep Your compile 'com.google.android.gms:play-services:4.0.30' as very first line in build.gradle dependencies like
dependencies {
compile 'com.google.android.gms:play-services:4.0.30'
compile 'com.android.support:support-v4:18.0.+'
compile 'com.android.support:appcompat-v7:+'
}
`
Open File> Project Structure and do the following steps
Select your main module in which you want to add dependency and click on OK.
Now try to import.
I think the most important question is what you want to achieve. Not all code is under this package. Not even sure which one is.
As noted before, this is a bug with Android Studio. It just don't recognize the path for classes and shows you like if there is an error. If you try compiling you'll see that everything just work fine.
A googler recently said it'll be addressed in this week release, so, be patient and lets see whats coming.
The fact that AS is in Preview mode tell us this sort of things are going to happen :)
Android studio is crazy one, I think.
It's removed "Import module" function and you can do "New module" only.
If you are developed on Eclipse, you need export all your projects to Gradle before switch to Androids studio (WTF?)
I prefer "IntelliJ IDEA Community Edition", although It's similar Android studio but it's better than Android studio (at least until now). You just import your project as eclipse format, IntelliJ IDEA will detect dependences libraries automatic (May be you need import jar libraries by hand) and rebuild project. That Done.