Integrating appcompat with LibGDX's Gradle Projects in Eclipse - android

I am attempting to merge a pre-existing Android project that uses appcompat with a game written using LibGDX. The problem is, I have no clue how to tell Gradle I need appcompat.
I've tried adding appcompat via the usual method (see the section labeled "Adding libraries with resources") and while this works for a regular project, it fails for the LibGDX's Gradle one. Where there is usually a check-mark verifying that a library project was added successfully, this just has a red x.
Screenshots of Properties Pages:
Example Errors due to this problem:
Error retrieving parent for item: No resource found that matches the given name '#style/Theme.AppCompat'.
So my question is, how do I build a LibGDX project with appcompat using Eclipse?

Have you tried adding the dependency into the build.gradle file?
dependencies {
...
compile "com.android.support:appcompat-v7:18.0.+"
}

Related

How do I add in a class created in a different android project?

Please forgive the vague sounding title
I am trying to get this project to compile in android studio:
https://proandroiddev.com/how-to-create-a-bubble-selection-animation-on-android-627044da4854
https://github.com/igalata/Bubble-Picker
Downloading the github project and compiling it as it is did not work, I am getting this error, and redownloading dependencies and syncing as suggested in the error message did not work
UPDATE: I have upgraded android studio, gradle and kotlin plugin to latest version and it's still the same problem.
I can use the library version of this project just fine, using the steps described in the github page. I want to compile the source code of this component together with my project so that I can tweak the bubble animation itself. Since the github project itself does not compile, I created a Hello World project first, then manually copied in the bubblepicker folder in the Hello World project. Inside the bubblepicker folder, I changed the name of the folder tree java/com/iglata/bubblepicker to java/com/test/app/bubblepicker, and changed the package name of the files inside this folder to reflect this. I then copied the code in DemoActivity.kt to my MainActivity.kt and changed the package names and made few minor adjustments to make the compiler errors go away.
I have made some modifications in the gradle files as well so that gradle syncing does not give any errors. However, anything inside bubblepicker does not seem to be detected in the MainActivity.kt, or it's activity layout xml file. For example,
import com.test.app.bubblepicker.BubblePickerListener
is marked with red colour in android studio and the error is unresolved reference. If I remove all references to bubblepicker and replace the code in MainActivity.kt with the Hello World code, then it compiles and runs fine, so it's as if bubblepicker is not getting picked up by the compiler at all.
What could be the problem here?
Or at the very least, how can I compile the bubblepicker github project? Simply loading the whole project in Android Studio is giving me compiler errors. I am doing this on Android Studio 3.5 on macOS with Kotlin version latest as of September 4.
I didn't get any error while import Github project.
Kindly update your android studio and kotlin Gradle version and check same.

The container Android Dependencies references non existing library /home/user/workspace/appcompat_v7/bin/appcompat_v7.jar

I am new to android and this question is asked several times in this forum. But I couldn't able to solve the problem with the answers in those post. So I am posting my problem here to get your support
I have created a new appcompat library in eclipse juno as mentioned in the below link.
https://developer.android.com/tools/support-library/setup.html
(the Referenced Libraries in this new support-library has both android-support-v4.jar and android-support-v7-appcompat.jar)
then i created my first Android project HelloWorld.
(the Android Private Libraries in this folder has both android-support-v4.jar and android-support-v7-appcompat.jar
When I buitd this project, it failed with the below error
"the android dependencies references non existing library /home/user/workspace/appcompat_v7/bin/appcompat.jar"
In the below post it was mentioned that the appcompat library project needs to be built first, before using it as reference in other projects.
The container 'Android Dependencies' references non existing library
so i built the library project. It fails with error
/home/user/Developer_Share/sdk/extras/android/support/v7/appcompat/res/values-v21/styles_base.xml:49: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
could you please advise how to resolve these issues so that the project HelloWorld is built successfully.
Create a new project with minSdkVersion as 14. This is the minimum version that do not require appcompat_v4 and v7 libraries and it is just a workaround for this issue.

Eclipse new project errors

Everything starts out fine with setting up the workspace and project, but I can'at run as an application because there are errors I can't clear. I have tried building java paths and downloading sdk tools and libraries.
and then these errors occur... I did try to connect to appcompat v7 jar, but it did not work. I am a beginner to Eclipse it would be nice if anyone can give some detailed answers and solutions please.
The errors are specifically:
error: Error retrieving parent for item: No resource found that matches the given
name 'android:Widget.Material.ActionButton'. styles_base.xml /appcompat_v7/res/values-v21
The container 'Android Dependencies' references non existing library 'C:\Users\Documents\Android Experiments\appcompat_v7\bin\appcompat_v7.jar'
The project cannot be built until build path errors are resolved
You may want to search for similar posts here at oDesk, ie: Hello World Android App, Error: workspace\appcompat_v7\res\values-v21\styles_base.xml No resource found that matches the given name
AFAIK the first issue happens when you install Android-L SDK, it somehow conflicts with Eclipse's new project wizard (the wizard adds those resource files with errors, you can just remove them in res folder)
About the second issue - probably you need to fix path to appcompat_v7.jar file, see the post where it is in project settings. It may fix the first issue as well, I'm not sure
It's time to switch to android studio even though it's beta the build is .8 which should suffice as significant evidence that it's nearing release. The gradle builds with appcompat are seamless automatic it's so much easier than eclipse to use external libraries.
This is all it takes in the build.gradle with android studio.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21+'
compile "com.android.support:support-v4:21+"
}

error: Attribute "***" has already been defined when using two library projects in Android

I'm using android-support-v7-appcompat as a library in my Android project. Now I want to include actionbarsherlock as another library project. When I add the second library, it gives so many errors like below
android-support-v7-appcompat\res\values\attrs.xml:476: error: Attribute "attributeName" has already been defined
By changing one attribute value and it's related code snippet is a one solution that I've tried. But when there are nearly 80 lines like above, it will get a messy. Is there any other way I can solve this issue?
The correct way to solve this problem is by updating Android Support Libraries in all relevant projects and library projects. In my case I've used Android support library and also one of the library project to implement my application. When I update both libraries, the problem solved. The way of updating Android support library is;
Right click on the project
Select Android Tools from the pop up window
Select Add Support Library
Remove the appcompact support library project from Properties = > Android
Gradle Resource Merger merges all resource folders from all dependencies and place into single folder. In case there are duplicates build process will fail.
Fortunately, if you look below under Output: label, you will find the right path to the problem.
Here is an example
in your case it is
android-support-v7-appcompat\res\values\attrs.xml:476: error: Attribute "attributeName" has already been defined
You can also build your project from command line and get the right path.
attributeName
Inside values\attrs.xml file on line 476 you would find a with property named "attributeName". Most probably it is your own styleable that you have to change to get rid of the duplicate.
So now, when you know the reason, you can locate that property in your project module and replace it with different name.
I solved this by removing appcompact from project, and changing in styles to
<style name="AppBaseTheme" parent="Theme.Sherlock">
I updated the build tools version and resynced, it worked fine.

How do I add the library android-support-v7 in IntelliJ IDEA (Not Android Studio/Gradle)?

I copy appcompat folder from Android SDK extras v7 folder and create a Android library module in my project. Compiling project I get errors, first one being appcompat/res/layout/abc_action_mode_close_item.xml:17: error: Error: No resource found that matches the given name (at 'contentDescription' with value '#string/abc_action_mode_done'). Looks like appcompat needs mediarouter resources as well. So I create a Android library module mediarouter. I set mediarouter as a dependency for appcompat library. Compile. Now I get the error mediarouter/res/values/styles.xml:18: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.ActionButton'. I add depenency appcompat to mediarouter. Compile. Now I get the errors
appcompat/res/values/attrs.xml:32: error: Attribute "windowActionBar" has already been defined
Help!
You just need to add "#string/abc_action_mode_done" in your appcompat/res/values/strings.Do not "set mediarouter as a dependency for appcompat library".(In my case,"#string/abc_action_mode_done" already exists in the appcompat/res/values/strings.I don't know why you miss it.)
"add depenency appcompat to mediarouter" is necessary.
I stumbled across this problem and it seems to be a bug in IDEA:
when you create the library module, IDEA will create some boilerplate files in the new module. During this operation, IDEA will overwrite the strings.xml resource file with some kind of template strings.xml-file intended for newly created android applications (IDEA will also create other stuff you don't want or need).
There are two workarounds:
1. Create the library module in IDEA first and copy the appcompat-resources afterwards into the existing library module directory
2. Just make the sub folders readonly before you create the library module in IDEA. This will prevent IDEA from changing the files in the library.
After that, the library module compiled on my machine.

Categories

Resources