Build Errors (token_refresh.xml) for Android Hackbook in Eclipse - android

I followed Facebook's Android dev site to setup Facebook Android projects in Eclipse:
https://developers.facebook.com/docs/guides/mobile/android_hackbook/
I used the "debug" target in build.xml to build using Ant. But I'm getting these errors:
[aapt] E:\Android\facebook-android-sdk\examples\Hackbook\res\layout\token_refresh.xml:15: error: Error: String types not allowed (at 'layout_width' with value 'match_parent').
[aapt] E:\Android\facebook-android-sdk\examples\Hackbook\res\layout\token_refresh.xml:28: error: Error: String types not allowed (at 'layout_width' with value 'match_parent').
BUILD FAILED
C:\Android\android-sdk-windows\tools\ant\build.xml:598: The following error occurred while executing this line:
C:\Android\android-sdk-windows\tools\ant\build.xml:627: null returned: 1
Why is the token_refresh.xml erroring out? I haven't made any changes to the latest facebook sdk that I pulled down from github.
I did change Hackbook's APP_ID to use a new one I created. I have the facebook sdk referenced in this project. I have libs folder in this project.
I open token_refresh.xml and it shows these errors in the log:
NOTE: This project contains resource errors, so aapt did not succeed, which can cause rendering failures. Fix resource problems first.
Failed to convert #color/grey into a drawable
Couldn't resolve resource #string/app_name
Couldn't resolve resource #string/access_token_label
Couldn't resolve resource #string/access_token_expires_label
Couldn't resolve resource #color/grey
Couldn't resolve resource #string/refresh_button
Couldn't resolve resource #string/tip_label
Couldn't resolve resource #string/refresh_token_tip
Exception details are logged in Window > Show View > Error Log
Does anyone know how to fix these problems?
Thank you

Hackbook only works on Android SDK 2.2 +. I had it set to 2.1, so it didn't work. Now it compiles and runs on my AVD 2.2.

Related

Xamarin Android XML Errors for Resource Localization

We have started to see random errors in a Xamarin Android build in Azure DevOps that appear to be related to the localization of resource files:
/Users/runner/work/1/s/Apps/MyApp/MyApp.Droid/obj/Release/lp/187/jl/res/values-hu/values.xml(1): error APT2254: xml parser error: no element found.
/Users/runner/work/1/s/Apps/MyApp/MyApp.Droid/obj/Release/lp/187/jl/res/values-hu/values.xml : error APT2261: file failed to compile.
/Users/runner/work/1/s/Apps/MyApp/MyApp.Droid/obj/Release/lp/187/jl/res/values-hu/values.xml(1): error APT2254: xml parser error: no element found.
/Users/runner/work/1/s/Apps/MyApp/MyApp.Droid/obj/Release/lp/187/jl/res/values-hu/values.xml : error APT2261: file failed to compile.
We don't support localization in our app so I don't understand why the build is trying to create localized versions of the resources. We still see the error even if we specify <AndroidResgenExtraArgs>-c en</AndroidResgenExtraArgs> in the project.
The build doesn't always fail and when it does it fails for different language codes. We don't see the issue when building locally but this could because we would normally be building for debug.
Have we misunderstood what is happening here? What could be the cause of the issue?

AAPT: error: resource android:attr/popupPromptView is private

I am using actionbarsherlock library in my android app and I am using one of its style attribute with the name of popupPromptView but when I try to generate the apk for my app, it gives me this error:
C:\Users\My Username\.gradle\caches\transforms-2\files-2.1\fa481916e694bf5a6973eb98ad535c2d\jetified-actionbarsherlock-4.4.0\res\values\values.xml:268:5-296:25: AAPT: error: resource android:attr/popupPromptView is private.
I tried going to this values.xml file and comment out this style attribute but when I try to generate the apk again, that line which I commented comes back again. I don't know what's wrong. I have even tried deleting the cache folder of .gradle but still no luck.
I had the same problem
You can solve downloading Sherlock as a module itself to compile together with your project (I imported the Sherlock modules from a Eclipse project) instead of using a library reference
In this way you can remove that line in a definitive way
it made my day
https://developer.android.com/studio/command-line/aapt2
In previous versions of AAPT, the compiler would silently ignore foregroundInsidePadding attributes when you define it with the android namespace. When using AAPT2, the compiler catches this early and throws the following build error:
Error: (...) resource android:attr/foregroundInsidePadding is private
To resolve this issue, simply replace android:foregroundInsidePadding with foregroundInsidePadding.

Android Studio resource linking failed and quick access to the problematic files

In old times of Android Studio, when I had compilation error and something was wrong resources I could quickly click on the error and was pointing me to the file. Now I’m getting error com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed but there is nothing to click that takes me quickly to the file to fix an error. Can I find these links somewhere?
You can find the issue on your project using the build report on Android Studio. You just need to switch between views:
This view will show the gradle build logs, and most likely will contain the resources issue.

How can I get cardslib into eclipse

hope someone knows better.
Since hours I try to include the cardslib - https://github.com/gabrielemariotti/cardslib, unfortunately without success.
When I want to including as it's described in the https://github.com/gabrielemariotti/cardslib/blob/master/doc/BUILD.md#reference-this-project-as-a-library-in-eclipse.
When I want to load the lib into the workspace the Error "An internal error occurred during: "Adjusting Android Project Classpath".
Source attachment path 'C:\Users\User\android-sdks\sources\android-14' for IClasspathEntry must be absolute" appears.
I never had such an error before. What causes it?
After pressing "OK" the lib gets into the workspace and "cardslib] Using 1.7 requires compiling with Android 4.4 (KitKat); currently using API 14" is shown on the console. So the lib is marked with an error.
After getting through the document (mark as lib etc. in properties) I still get some errors:
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
BuildConfig.java /cardslib/gen/it/gmariotti/cardslib/library/cards line 1 Java Problem
error: Error retrieving parent for item: No resource found that matches the given name 'card.native'.
styles.xml /cardslib/res/values line 23 Android AAPT Problem
The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project cardslib Unknown Java Problem
I asked google about it already but didn't find a match so I hope someone can help me out.
Thanks in advance.

No resource found that matches the given name '#android:style/Widget.Holo.ActionBar'. R Cannot be resolved to a variable

First of all i want to say that i know this topics have been brought up lots of times. But i can't seem to find the solution for this problem.
This is some of the errors from the log:
/home/name/adt-bundle-linux-x86_64-20140702/sdk/extras/android/support/v7/appcompat/res/values-v14/themes_base.xml:159: error: Error: No resource found that matches the given name: attr 'android:actionBarWidgetTheme'.
/home/name/workspace/Projectname/res/values-v14/styles.xml:4: error: Error: No resource found that matches the given name: attr 'android:actionBarStyle'.
/home/name/workspace/Projectname/res/values-v14/styles.xml:5: error: Error: No resource found that matches the given name: attr 'android:windowActionBar'.
/home/name/workspace/Projectname/res/values-v14/styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name '#android:style/Widget.Holo.ActionBar'.
I'v made a custom theme, and im using Actionbar.
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="9" />
All of this used to work, then i had to reinstall my eclipse, so i imported the project to the freshly installed one. And that is when the errors occurred.
The R.File is also missing.
Please help me, im starting to lose my mind becuase of this problem.
EDIT 1:
To clear things out. I added the android-support-v7-appcompat with this method (Adding libraries with resources):
http://developer.android.com/tools/support-library/setup.html
The project build target on android-support-v7-appcompat is Android 4.0 and the project build target on my project is Android 2.3.3.
Is this right? Im not really sure what it should be like.
I can't say exactly, but if you are using appcompt library,
Project(Right Click)--> Properties--> Android--> Library section--> Add--> appcompt library.
can you please check this once.
Edit :
Compile with API Level 14 - when you compile your app with SDK level 9, the compiler doesn't know the elements shown in the error log
Or Project(Right Click)--> Android Tools --> Add Support Library / Fix Project Property..

Categories

Resources