I've got big old project for Android to support. It was developed under old Gradle version (2.2.3). I used to work with the latest Android Studio and now I'm trying to migrate this project to the current Gradle version (3.1.2).
I've read guide from Google on this and applied recomendations from it. I managed to fix all issues excepting two. The first one is
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
I made all replacements in my project and as I understand it's caused by a library from dependencies. OK, let's live with it. But the second issue is
error: resource android:attr/foregroundInsidePadding is private.
Message{kind=ERROR, text=error: resource
android:attr/foregroundInsidePadding is private.,
sources=[C:\Users\alexanderk.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.1.1.aar\b3fbcbe446f57e45b23f5cfcf67ccbb9\res\values\values.xml:203:5-69],
original message=, tool name=Optional.of(AAPT)}*
Google's guide says about this the following
To resolve this issue, simply replace android:foregroundInsidePadding with foregroundInsidePadding.
That's OK, I open the problem file values.xml, go to line 203 and... surprise, no foregroundInsidePadding here. Moreover, there is no this word in the whole xml. I tried invalidate Gradle cache but the issue appears again after Gradle recreates cache. And I can't ignore this since this issue stop building.
Any ideas how to solve this?
appcompat-v7-25.1.1.aar\b3fbcbe446f57e45b23f5cfcf67ccbb9\res\values\values.xml
Looks like it complains not about values.xml in your project but about one within the appcompat library. Try to bump support library version
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.
I am working on a project that will have a 3D model viewer in one fragment. In order to do so, I decided to use sceneform.
I downloaded sceneform plugin into Adnroid studio, downloaded and extracted sdk from Github, and I also copied libsceneform_runtime_schemas library into my project. I've added to my sceneform buil.gradle file line
implementation files("../libs/libsceneform_runtime_schemas.jar")
but that results in an error:
Program type already present: com.google.ar.schemas.lull.AabbDef
It is worth noticing that this is the first file in the jar under this path - which probably means that there will be more collisions.
If I'd try not to implement this library, then I get an error:
error: package com.google.ar.schemas.sceneform does not exist
I am using ar:core:1.17.0, and minSdkVersion 24 in sceneform gradle.
I've cleaned and rebuilt the project, Invalidate Caches/Restart, and added multiDexEnabled- although I am not sure if I did it correctly.
By using gradlew sceneform:dependencies I didn't find mentioned file.
I don't know how I can move forward, any help is much appreciated. If I can provide additional information, please let me know.
Edit 1:
I've also tried to work with
implementation files("../libs/libsceneform_runtime_schemas.jar"){
exclude ...
}
But I couldn't make it work. I wonder if that could be my solution.
Also, why does it try to implement this class since it already exists? Shouldn't there be some sort of check for that?
I solved my problem by restoring my project from repo to the last moment before including sceneform, and I proceeded with all of the steps again; Gradle dependencies to the libsceneform_runtime_schemas, min java 8, min SDK version, copying scenformscr and sceneformux to my project again, and lastly - upgrading all classes to AndroidX.
After two days almost I couldn't remove the error, and I don't know what went wrong before, but this time it works like a charm.
TL;DR - I removed the sceneform from my project and imported it again.
I created a Xamarin.Android project and after I set the configuration:
- Dex compiler: D8
- Code Shrinker: R8
- Linking: Sdk Assembleies Only
I am presented with this error:
Program type already present: android.support.annotation.PluralsRes
I also have the LinkerPleaseInclude file.
I have to say that I am in Debug configuration.
I solved this issue by clearing cache for Nuget Packages.
I know I'm a bit late but since the answer for this matter did not work for me, here is how I solved it:
First of all, it's obviously a NuGet packages problem, so I searched in my .nuget folder at C:\Users{yourUser}.nuget\packages and looked inside some of the folders, in my case the Android support libraries folders, and saw that there were folders for many versions of that library excetp for the one I was referencing in my project wich was 28.0.0.3, the last version at this moment, the newest I had in the folder was for 28.0.0.1 so instead un uninstalling and installing everything again I just modified the android.csproj, changed the referenced versions for the support libraries for 28.0.0.1 and then it gave another error, I just literally downgraded some other libraries to 28.0.0.1 from Visual Studio NuGet package manager and then everything worked fine.
Have a nice one. It took weeks for me of trying to find out.
Neither of the above solutions worked for me. I encountered the error opening an Xamarin project that was created in VS 2015 on VS 2019. I changed the "Compile using android version" in the manifest to Android 9.0, updated the NuGet packages, but this error remained. I also attempted the tried-and-true deleting ".vs", "bin" and "obj" folders.
What finally got rid of the "Program type already present: android.support.annotation.PluralsRes" error was deleting everything in the "Packages" folder for the project. My understanding is that directory was eliminated in VS 2017, but suppose because the original project was VS 2015 it was still being utilized and causing the conflict.
I was getting
Program type already present: androidx.appcompat.content.res.AppCompatResources$ColorStateListCacheEntry error.
I had 2 references
a)Xamarin.AndroidX.Appcompat and
b)Xmarin.Androidx.appcompat.content.res.AppCompatResources
I removed the reference Xmarin.Androidx.appcompat.content.res.AppCompatResources
And now the project builds without errors
I had my program building successfully but then I updated my Android Studio to version 1.0.
First I had this error after the update:
Error:The project is using an unsupported version of the Android Gradle plug-in (0.12.2). The recommended version is 1.0.0-rc4.
Fix plugin version and re-import project
Then this error that I fixed by replacing runProguard by minifyEnabled:
Error:(16, 0) Gradle DSL method not found: 'runProguard()'
And finally this error appeared:
Error:Class android.support.v4.app.NotificationCompatIceCreamSandwich has already been added to output. Please remove duplicate copies.
I already looked in several places but couldn't find a solution. Does anyone know how to solve it? The project was building successfully until the update.
For those who might have the same problem as me, I solve my problem the hard way. The solution I found was create a new project with the same name, copy all the basic files (java, xml and drawable) to the new project and copy the lines I wanted from the manifest. After it builds the Gradle, it builds sucessfully. I think the reason must be about the new arrangement of foulders from the version 1.0
There must be a better way but until then, at least now it works. Thanks to those who tried to help
I'm trying to install and test the andgram application available at https://github.com/markchang/android-instagram.git
But, some layout files show the following message and Eclipse doesn't generate the R.java file:
NOTE: This project contains resource errors, so aapt did not succeed, which can cause rendering failures. Fix resource problems first.
Couldn't resolve resource #style/ActionBar
I thought it was the SDK version, but I have the version 8 installed and it doesn't solve the problem.
I would appreciate any help.
Thanks!
The library you are trying use depends on the android-actionbar library. Have you downloaded that library and added it as a library project to your project?
Edit:
FYI, The actionbar library it depends on is outdated (2+ years).
You have change your build target to at least API 11 in order to support the ActionBar.