Unresolved reference: R in Android with Navigation-args - android

After updating Android Studio I have this error with Navigation-args
Build failed
API 'BaseVariant.getApplicationIdTextResource' is obsolete and has been replaced with 'ApplicationVariant.applicationId'.
It will be removed in version 9.0 of the Android Gradle plugin.
For more information, see TBD.
To determine what is calling BaseVariant.getApplicationIdTextResource, use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
:app:compileDebugKotlin
SearchNsdFragmentDirections.kt
Unresolved reference: R
Unresolved reference: R
org.gradle.api.GradleException: Compilation error. See log for more details
Any idea about it?
I tried to revert gradle-wrapper properties and revert other libreries...

Solution:
Its because you are missing the package name in a manifest file here:
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.yourname"
I clicked in Android Studio suggestion and it removed package name from Manifest.
Now it works properly!

Related

unknown property ‘manifestOutputDirectory’

I had to integrate a library into my app and the library had its gradle version as 4.0.0, while my app had 3.2.2 (or something). So it bumped into the queries tag in the library (in its Manifest) that it wouldn’t recognize. Therefore I have updated the gradle version in my app to be the same as the library, at 4.0.0 (now I put it as 4.1.0, the latest).
The problem is that I bump into the following error:
`Execution failed for task ‘:app:processCanaryDebugManifest’.
Could not get unknown property ‘manifestOutputDirectory’ for task ‘:app:processCanaryDebugManifest’ of type com.android.build.gradle.tasks.ProcessMultiApkApplicationManifest.
This is based on this warning:
API 'variantOutput.getProcessManifest()' is obsolete and has been replaced with 'variantOutput.getProcessManifestProvider()'.
I haven’t been able to make any progress on this. I have ran the gradlew command with --stacktrace but all I get are errors from gradle, nothing specific. Do you know of any way to make this work? The only things I've found so far are issues with a Huawei thing, but it's not the case for me. Thanks!
PS. I'm not sure what additional info would be useful in this circumstance.
EDIT: I've downgraded to gradle 3.3.3 and commented out my new library dependecies, and now it says:
`Execution failed for task ':app:processCanaryDebugManifest'.
java.io.FileNotFoundException: property(interface org.gradle.api.file.Directory, transform(property(interface org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultProjectLayout$FixedDirectory, C:\build\myapp\app))))\AndroidManifest.xml (The filename, directory name, or volume label syntax is incorrect)`

Warning during App build on Android studio 3.6.1

I just updated Android studio 3.6.1 and while building my app I got following warning:
Configure project :app
WARNING: The following project options are deprecated and have been removed:
android.enableUnitTestBinaryResources
The raw resource for unit test functionality is removed.
What is this warning about and how to remove this?
The robolectric instructions say that this configuration is not necessary with Android Studio 3.3+
So, please check your gradle.properties file and remove this line:
android.enableUnitTestBinaryResources=true
In my case, I just cleared my gradle cache files and that seemed to have resolved the problem
My problem solved by removing configuration at gradle.properties. see below:
#android.enableBuildCache=true

Android Studio and Gradle - seemingly misleading warning regarding testCompile, testImplementation, testApi

I get these two lines when compiling an old Android project using latest Android Studio (3.1.4):
WARNING: Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation' and 'testApi'.
WARNING: Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
I understand what they mean and how I can fix these warnings, there are also questions explaining it, but I can't any reference to 'testApi' anywhere on developer.android.com. Is it an error in warnings or was there testApi command? Was it added alongside 'testImplementation' and was later deprecated?
Previously we used testCompile but as per the last Gradle update Android Studio sometimes shows this messages though we edit the gradle file with new keywords.Now the "testApi" was not there in gradle as per my own experience.I think this error message is a fault.

Error on changing "buildToolsVersion" of project in Android Studio

I use Android Studio 3.1.4 and android gradle plugin version 3.1.4.
Previously I set buildToolsVersion "27.0.3" in build.gradle of module and there was no problem in building/running. Today I installed newer version of build tools and change build.gradle to use that: buildToolsVersion "28.0.2"
But when I try to sync project with gradle files or rebuild project it ends with AAPT2 error:
AGPBI: {"kind":"error","text":"error: \u003citem\u003e inner element must either be a resource reference or empty.","sources":[{"file":"<path to module>/src/main/res/values/ids.xml","position":{"startLine":16,"startColumn":4,"startOffset":752,"endColumn":55,"endOffset":803}}],"original":"","tool":"AAPT"}
....
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':<modulee-name>:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
But I do not understand what causes the error. For example addressed line in error is:
<item type="id" name="bookmark">false</item>
What causes this error and how I can solve this problem?
Edit
I added android.enableAapt2=false to the gradle.properties and it seems ignores error, but causes this warning:
The option 'android.enableAapt2' is deprecated and should not be used
anymore. Use 'android.enableAapt2=true' to remove this warning. It
will be removed at the end of 2018..
you cannot assign false (nor any other value but it's name) to an ID resource.
An ID is a simple resource that is referenced using the value provided in the name attribute (not the name of the XML file). As such, you can combine ID resources with other simple resources in the one XML file, under one element. Also, remember that an ID resources does not reference an actual resource item; it is simply a unique ID that you can attach to other resources or use as a unique integer in your application.
with android.enableAapt2=false it might ignore the logical error, but not "fix it".

android.R.id not found after Gradle update

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.

Categories

Resources