Android studio gives error on compilation, No resource found - java

I tried to compile a project with target SDK 13, and then i got few errors about resources. I got few same errors, and one of them is:
android-apt-compiler: [android-master5] C:\Documents and Settings\...\Local Settings\Application Data\Android\android-studio\sdk\android-master5\res\values\styles.xml:24: error: Error retrieving parent for item: No resource found that matches the given name 'style/Theme.Sherlock.Light.DarkActionBar'.
What should I do ?
Sorry for bad english.

In the file styles.xml that is mentioned in the error, if line 24 literally says:
'style/Theme.Sherlock.Light.DarkActionBar'
then change it to:
'#style/Theme.Sherlock.Light.DarkActionBar'
(You just missed the # symbol)

I found this post while searching for a similar error message that I got when migrating from eclipse to Android Studio. In my case the very same theme was not found for AndroidManifest.xml:
My Problem was solved by adding
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'com.android.support:support-v4:18.0.+'
to the dependencies in the gradle file as suggested here:
https://github.com/JakeWharton/ActionBarSherlock-Gradle-Sample
Speaking of, it seems AppCompat is the new thing for backwards compatible ActionBars...

Related

Gradle did not find Minecraft Mappings for 1.12.2?

I would like to learn minecraft mod development, but there is an error with downloading the mappings
The error message is:
Could not resolve all files for configuration ':runtimeClasspathCopy'.
Could not find net.minecraftforge:forge:1.12.2-14.23.5.2860_mapped_snapshot_20180814-1.12.
Searched in the following locations:
- file:~/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.12.2-14.23.5.2860_mapped_snapshot_20180814-1.12/forge-1.12.2-14.23.5.2860_mapped_snapshot_20180814-1.12.pom
- file:~/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.12.2-14.23.5.2860_mapped_snapshot_20180814-1.12/forge-1.12.2-14.23.5.2860_mapped_snapshot_20180814-1.12.jar
Required by:
project :
Possible solution:
Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
The directories specified does not exist. Also I tried downloading and importing the MCP instead of using an IntelliJ Plugin for Minecraft. The same error occurred while using this but there was a few more links (that leads to a webpage) that does not exists ("error 404 not found") if I clicked them.
The line in build.gradle which specifies the mappings used is at the moment:
mappings channel: 'snapshot', version: '20180814-1.12'
It was a stable version before and there was the same errors.
Does anyone know what I can do about it?
i had the same problem and i fix it by changing it to java 1.8 eclipse temurin
btw sorry for my bad english

Getting Androidx library issue even though its not enabled in android project

I am getting this issue
This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled. Set this property to true in the gradle.properties file and retry.
The following AndroidX dependencies are detected: androidx.annotation:annotation:1.1.0
I keep getting this error and I have been searching the internet to figure out what is wrong and I cannot find anything
"And I can't use Androidx library in my project "
In many of the answers on SO on this problem it has been suggested to add exclude 'META-INF/DEPENDENCIES' and some other excludes. However none of these worked for me. In my case scenario was like this:
I had added this in dependancies:
implementation 'androidx.annotation:annotation:1.1.0'
And also I had added this in gradle.properties:
android.useAndroidX=true
Both of these I had added, because I was getting build error 'cannot find symbol class Nullable' and it was suggested as solution to this on some of answers like here
However, eventually I landed up in getting error:
More than one file was found with OS independent path 'androidsupportmultidexversion.txt'
No exclude was working for me. Finally I just removed
implementation 'androidx.annotation:annotation:1.1.0'
from build.grdle file.
and finally I got rid of this
( More than one file was found with OS independent path 'androidsupportmultidexversion.txt' )
"More than one file was found with OS..." build error.
I wasted hours of mine.But didn't found solution of this.
Then i just change my project
minSdkVersion 19
to
minSdkVersion 21
And finally i am able to build my apk file without any error

Cant include appcompat_v7 in library in Eclipse

I am a new in Android Development and I am having some issue about the R.java file. And I read some suggestions that in order to generate this file you shouldn't have any error on the XML file. In my case I fave an error in my styles.xml
error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
And also this:
ActionBarActivity cannot be resolved to a type
And I read this solution that I need to reference the AppCompat but when I checked on my settings the AppCompat has an error.
I already updated my SDK tools with the latest one
And also can you help me how can I solve the problem in the R.java. What I know is it is auto generated but in my case it doesn't generate even I start a new project.
Can you help me with this? So that I can continue my study. Thanks.

Error: No resource found that matches the given name (at 'theme' with value '#style/Theme.Material.Light.DarkActionBar')

Hello I am trying to use the them "Theme.Material.Light.DarkActionBar"
I updated my SDK and ADT, I have the latest lollipop phone. I am compiling it with android 5.1.
I changed manifest to
android:minSdkVersion="22"
android:targetSdkVersion="22"
Inside of my manifest I put:
android:theme="#style/Theme.Material.Light.DarkActionBar"
However I get the error saying Error:
No resource found that matches the given name (at 'theme' with value '#style/Theme.Material.Light.DarkActionBar') .
How can i fix this so I can use this theme in my app please. ps I am using Eclipse.
You should change:
android:theme="#style/Theme.Material.Light.DarkActionBar"
To
android:theme="#android:style/Theme.Material.Light.DarkActionBar"
Because it is an Android resource and not your project's resource.
As referenced in https://developer.android.com/training/material/theme.html
you should try -
#android:style/Theme.Material.Light

Android Studio - Resource Entry already defined

After compiling my Android application using the Android Studio (Beta), I have the following error:
Error:error: Resource entry background is already defined.
res\drawable-xhdpi-v4\background.9.png:0: Originally defined here.
This occurred when I had a image file called "background" in my res folder.
I then made a 9 patch version of it and pasted it in the same folder. This meant that there was 2 files with the same name. So I unsurprisingly I had this error.
However I now deleted all instances of the background image file (including the 9 patch version and original image) in my code and layout file and I still have this error.
You could try to do one of the following:
Clean and Build or gradle clean build assemble
Invalidate and restart Android Studio
1 Build > Clean Project
2 Build > Rebuild Project
I am using Android studio and I run exactly into the same issue and none of the answers I found on the web helped me solve the problem, including the previous one. So reading through all details of the error messages and found this lines:
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\user\AppData\Local\Android\android-studio\sdk\build-tools\android-4.4W\aapt.exe package -f --no-crunch -I C:\Users\user\AppData\Local\Android\android-studio\sdk\platforms\android-20\android.jar -M C:\Users\user\AndroidStudioProjects\DartsApp\app\build\intermediates\manifests\debug\AndroidManifest.xml -S C:\Users\user\AndroidStudioProjects\DartsApp\app\build\intermediates\res\debug -A C:\Users\user\AndroidStudioProjects\DartsApp\app\build\intermediates\assets\debug -m -J C:\Users\user\AndroidStudioProjects\DartsApp\app\build\generated\source\r\debug -F C:\Users\user\AndroidStudioProjects\DartsApp\app\build\intermediates\libs\app-debug.ap_ --debug-mode --custom-package com.dartstransit.dartsapp -0 apk --output-text-symbols C:\Users\user\AndroidStudioProjects\DartsApp\app\build\intermediates\symbols\debug
Error Code:
1
Output:
res\drawable-hdpi-v4\bus_w.png:0: error: Resource entry bus_w is already defined.
res\drawable-hdpi-v4\bus_w.jpg:0: Originally defined here.
As you can see there are two files of name bus_w with different extensions on the same folder. I had already removed those files from the project and still getting the error, so I decided to check every single folder of the project that was reference in the compiler line in the error message. Finally found that there was a copy of the file bus_w.png in the folder app\build\intermediates\res\debug\drawable-mdpi-v4.
I just deleted it and voila, problem solved.
A simple Build > Rebuild project helped me
Did you try rename this file to other name? It seem one of your libraries have same resource.
I see that many devs(include me) had issue with ic_launcher too. I think you want to try mipmap instead drawable. So we will have something like this:
\res\mipmap-hdpi
\res\mipmap-mdpi
\res\mipmap-xhdpi
\res\mipmap-xxhdpi
Hope this help.
I have also encountered this error recently.Here is my solution that works,hope it will help you.
1.only keep 9 patch version image in the drawable-hdpi folder
2.make sure the code related to this problem in xml file remains the same: android:background="#drawable/msg_left"
instead of using the code:
android:background="#drawable/msg_left.9"
PS:My original image name is msg_left,and my 9 patch version image name is msg_left.9
I did the trick by moving the icon
drawable/ic_launcher
to
mipmap/ic_launcher
and it worked fine :)
In my case the problem was that I had more than one '.' in the filename. like:
a.png
a.bold.png
Solution was to rename to
a.png
a_bold.png
In our case, problem started occurring (error shows 'duplicate value for resource' in a library) when some other library was upgraded to it's latest version.
We just downgraded the version of the library that was upgraded.
Real pain was because that we have many dependencies which can be dynamically upgraded when there is a new version available in repositories. So my teammate had to go through all libs that can be dynamically upgraded and see if there is one that is recently upgraded, try to downgrade it and check if build goes fine. He identified many were upgraded on previous day. Downgrading one of them got the build back.
Conclusion we made is not to use Dynamic Versioning. Don't use dynamic versions for your dependencies.
This was the error by the way:
Task :app:generateDebugResources UP-TO-DATE
AGPBI: {"kind":"error","text":"error: duplicate value for resource \u0027attr/itemBackground\u0027 with config \u0027\u0027.","sources":[{"file":"/Users/unknownuser/.gradle/caches/transforms-1/files-1.1/singledateandtimepicker-1.2.2.aar/86ae3786d70c769e610c8a01d58aa638/res/values/values.xml","position":{"startLine":15,"startColumn":4,"startOffset":2427,"endColumn":48,"endOffset":2471}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"error: resource previously defined here.","sources":[{"file":"/Users/unknownuser/.gradle/caches/transforms-1/files-1.1/singledateandtimepicker-1.2.2.aar/86ae3786d70c769e610c8a01d58aa638/res/values/values.xml","position":{"startLine":15,"startColumn":4,"startOffset":2427,"endColumn":48,"endOffset":2471}}],"original":"","tool":"AAPT"}
Task :app:mergeDebugResources FAILED
Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
FAILURE: Build failed with an exception.

Categories

Resources