I am working on an android project that used Gradle 2.3.3 (at this point, there was no compiling issues). I upgraded Gradle to version 3.0.1, and made the required adjustments.
I removed retrolambda. I changed the keywords to use the new dependency configurations.
But my project doesn't compile, because it seems that android.R.* elements are not found anymore. The errors I have are :
Error:(524, 27) error: cannot find symbol variable id
Error:(625, 122) error: cannot find symbol variable id
Error:(74, 63) error: cannot find symbol variable color
on the following ids : android.R.id.home, and android.R.color.white.
What changed on Gradle 3.0.1 that could have triggered these errors ?
EDIT : I already tried to clear/invalidate caches, restart, sync Project with gradle files, clean, rebuild...
A coworker tried to compile the code on his computer : same error - it doesn't look like it is a cache issue.
Related
There is no problem with all codes before the update.
But After the update, many functions are unresolved.
My Android Studio version.
error code1
error code2
error code3
All error contents are Unresolved reference:~~.
my dependencies 1
my dependencies 2
There are my dependencies.
There is an error in the code, but the build works fine.
What's the problem?
Your compiler is unable to generate project files. Change the room dependencies(if being used) to '2.4.2' and upgrade your gradle to 7.0+
Also go to Android Studio-> preferences-> Build, version...-> Build tools-> Gradle and change the Gradle JDK to 11.
After upgrading to Android Studio 4.2 and Gradle to Gradle 6.7.1 plugin 4.2.0 we've got following build error but studio don't highlight any errors in the code.
What can be wrong?
Project uses Kotlin and databindings.
e: java.lang.AssertionError: No such enum entry LIBRARY_GROUP_PREFIX in org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl#b254b575
at org.jetbrains.kotlin.ir.util.ConstantValueGenerator.generateConstantOrAnnotationValueAsExpression(ConstantValueGenerator.kt:89)
at org.jetbrains.kotlin.ir.util.ConstantValueGenerator.generateConstantOrAnnotationValueAsExpression(ConstantValueGenerator.kt:81)
at org.jetbrains.kotlin.ir.util.ConstantValueGenerator.generateAnnotationConstructorCall(ConstantValueGenerator.kt:163)
at org.jetbrains.kotlin.psi2ir.generators.AnnotationGenerator.generateAnnotationsForDeclaration(AnnotationGenerator.kt:47)
at org.jetbrains.kotlin.psi2ir.generators.AnnotationGenerator.visitDeclaration(AnnotationGenerator.kt:25)
at org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid$DefaultImpls.visitFunction(IrElementVisitorVoid.kt:49)
at org.jetbrains.kotlin.psi2ir.generators.AnnotationGenerator.visitFunction(AnnotationGenerator.kt:13)
at org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid$DefaultImpls.visitSimpleFunction(IrElementVisitorVoid.kt:52)
at org.jetbrains.kotlin.psi2ir.generators.AnnotationGenerator.visitSimpleFunction(AnnotationGenerator.kt:13)
at org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid$DefaultImpls.visitSimpleFunction(IrElementVisitorVoid.kt:53)
at org.jetbrains.kotlin.psi2ir.generators.AnnotationGenerator.visitSimpleFunction(AnnotationGenerator.kt:13)
at org.jetbrains.kotlin.psi2ir.generators.AnnotationGenerator.visitSimpleFunction(AnnotationGenerator.kt:13)
at org.jetbrains.kotlin.ir.declarations.IrSimpleFunction.accept(IrSimpleFunction.kt:29)
at org.jetbrains.kotlin.ir.declarations.IrClass.acceptChildren(IrClass.kt:61)
If run build again with --info option we've got errors for databinding for our custom views like:
public final TileFrameLayout viewShortTileWithPxp;
^
symbol: class TileFrameLayout
location: class FavoriteTileWithPxpBinding.java:34: error: cannot find symbol
protected TileModeField mTileMode;
At the same time generated FavoriteTileWithPxpBinding.java has proper import for TileFrameLayout and Studio correctly show all dependencies.
All this worked before upgrade.
if you have an error that is No such enum entry LIBRARY_GROUP_PREFIX.
you should do implementation "androidx.annotation:annotation:1.1.0" to the module which error.
en..., I found if the only app is ok but if the app has other modules,it will have error like
'Task :life_module:compileDebugKotlin FAILED
e: java.lang.AssertionError: No such enum entry LIBRARY_GROUP_PREFIX in org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl#b254b575'
In my case, I migrated to Gradle 7.2. But as legacy, in the app level of Gradle, was this:
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:24.2.0'
}
It forced to use the version 1.0.0 of the 'androidx.annotation:annotation' lib, even if I obviously used the 'annotation' dependency with mentioning any other versions. The thing is that in this '1.0.0' version, there is no 'LIBRARY_GROUP_PREFIX' enum item.
After I have deleted the 'resolutionStrategy.force' block, all began to work.
Problem solved.
There were several changes:
Updating support libraries to AndroidX
Updating versions of some other libs like Dagger
Updating Kotlin
And yes, Invalidate caches & Restart after all of these.
After update Android Studio to 4.1 (4.1.1 also), I'm getting unresolved reference errors for resources defined in Gradle (app level). But project builds and resources have proper values when I refer to them.
in gradle file:
it.resValue 'string', "test_value", "test"
usage:
So my problem is just getting errors, project builds and everything works as it should.
Before the updates, the problem did not occur. Ofc I've tried build/rebuild, gradle sync, invalidate cache & restart - nothing changes.
Is there anything else what I can do?
I am constantly getting error:
cannot resolve sumbol R.
I had used solution like clean,rebuild, sync with Gradle file. All of them not working.
Today I have updated my Android Studio and I keep getting this error no matter what I do. I imported a project from github everything was running smoothly until I updated now I keep getting this error:
Error:(31, 0) Gradle DSL method not found: 'jniDebugBuild()'
Possible causes:The project 'my_application' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper fileThe build file may be missing a Gradle plugin.
Apply Gradle plugin
Can anyone help out?
The name of this property has changed in v0.14.0 and later of the Android Gradle plugin, so build files created for earlier versions need to be updated. Look through all the build.gradle files in the project, and when you see jniDebugBuild, change it to jniDebuggable.
You may run into other things that need to be renamed; the list of remappings is in the release notes at http://tools.android.com/tech-docs/new-build-system.