import project for low api, stylev21 not found - android

I research material design project for 4.x API, It seem too many problems in style values, always style.... (in v-21) not found. I think v-21 is only build with api 21. But I want to build for 4.x API, do anyone know problem?
Here is some project in Github i found:
https://github.com/wasabeef/awesome-android-ui
https://github.com/rey5137/material
I use eclipse too. Change ANdroid API 21,22,23 but it still not work
The Log say : no resource found that matches the given name "TextAppearance.Appcompat.Body1"
Here is my picture:
OTHER QUESTION:
The Author say this material project can run on API 2.x -> 4.x , but why it need to build with API 21 -> 23? So can lower device can run it?

Set compileSdkVersion 23 or 21 or above in your build.gradle file.
The Log say : no resource found that matches the given name
"TextAppearance.Appcompat.Body1"
This is because you might not have imported AppCompat Library to your Eclipse Project.
The Author say this material project can run on API 2.x -> 4.x , but
why it need to build with API 21 -> 23? So can lower device can run
it?
Yes, Its always a good practice to build your App with the latest API version as this will include all the updated resources which might be not available in previous versions of Android. However, this will not affect your APK size in anyways.

Related

How can I add foregroundServiceType to a library manifest while maintaining backwards compatibility?

My library project has a location service, and per Android Q requirements it sets the android:foregroundServiceType="location" attribute in the manifest. When an app module uses my library and compiles against API level 28, it fails with the following error:
AndroidManifest.xml:57: AAPT: error: attribute android:foregroundServiceType not found.
How can my library maintain compatibility with older versions, while making sure the functionality works on Android Q?
I had same error and after migrating to Androidx and updating compileSdkVersion from 28 to 29 my issue was resolved. So please do these changes and you can get your solution
My goal is to avoid breaking anyone's build when the library version is updated, and at the same time avoid forcing the developer to compile against API 29. It seems I have two choices:
Provide a separate library so that developers compiling against API 28 and lower don't get impacted;
warn developers targeting the new version to replace the service definition in the manifest using tools:node="replace".
The problem with the first approach is that I will need to maintain two libraries for some time. The problem with the second is that developers must remember to revert the change once they update the SDK version.
In my case, I will go with the second approach. By passing an explicit foreground service type to the startForeground method when targeting Android Q, I can cause a crash if the type is not set in the manifest. The developer can therefore catch this when targeting Android Q and revert the manifest change to fix it.

Xamarin.Android Targeting Android 4.4 Throws Error No resource identifier found for attribute touchscreenBlocksFocus in package android

Our Xamarin.Android app is targeting Android 4.4 due to hardware constraints. The initial solution was created targeting API 23 and was downgraded. The above error is thrown after downgrading. The code referenced by the error is as follows:
<include layout="#layout/abc_screen_content_include"/>
<android.support.v7.widget.ActionBarContainer
android:id="#+id/action_bar_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
style="?attr/actionBarStyle"
android:touchscreenBlocksFocus="true"
android:gravity="top">
<android.support.v7.widget.Toolbar
android:id="#+id/action_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:navigationContentDescription="#string/abc_action_bar_up_description"
style="?attr/toolbarStyle"/>
<android.support.v7.widget.ActionBarContextView
android:id="#+id/action_context_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:theme="?attr/actionBarTheme"
style="?attr/actionModeStyle"/>
</android.support.v7.widget.ActionBarContainer>
This error was replicated after creating a new solution targeting API 19 Android 4.4.
How do I remedy the above error?
Hit this in Xamarin Forms Project. Got this lovely:
"No resource identifier found for attribute 'touchscreenBlocksFocus' in package 'android' App1.Droid C:\dev\xamarin\dev\HWVFromScratch\App1 App1.Droid\obj\Debug\resourcecache\C6193E5D3119528BCA215B6037E272DE\res\layout\abc_screen_toolbar.xml"
To squarely target KitKat
Go into your Droid project properties
Set "Compile using Android Version" to "Use Latest Platform"
Set Minimum Android to Android 4.4( API Level 19 - KitKat )
Set Target Android version to Android 4.4 ( API Level 19 - KitKat )
Compiled like a champ. Screenshot of settings below...
This basically means that the Google tool aapt which is used to compile resources for your app doesn't know how to handle the touchscreenBlocksFocus attribute used somewhere in your resources (or in this case likely in the resources contained in the Android Support Libraries).
First it's worth reviewing my blog post explaining the various places API Levels are used in Xamarin.Android apps: http://redth.codes/such-android-api-levels-much-confuse-wow/
So in this case, your project's Target Android Version is what Xamarin.Android is passing to aapt as the API Level to build resources against.
This means you'll need to set your Target Android Version to a higher API Level (4.4 won't cut it) which understands the resource attributes you are using.
Of course, just because you change your Target Android Version doesn't mean you can't still have a lower Minimum Android Version specified, and your app can then still run on older API Levels.
Finally, it's generally best practice to set your Target Framework Version and Target Android Version to use the Latest SDK version available to avoid these types of issues. Then, set your Minimum Android Version to a lower API level if you wish. Of course you'll have to be aware of the API's you are using and that you take appropriate steps to gracefully avoid using API's that aren't available on a given version of Android at runtime.
It's been a month, but I would like to try and answer your question with the solution I had.
The problem I ran into was that I attempted to use Xamarin.Forms instead of functions/commands/API from the standard Android libraries.
One of the ways to install Xamarin.Forms is to use nuget - which I did. This however caused all kinds of problems, one of which you are experiencing.
So in order to stop these errors I had to remove several dependencies/references within the Xamarin Project by going to Project -> Edit References -> and on the right hand side of the window removing any Xamarin.XXXXX you might see starting with the obvious Xamarin.Forms and working your way through until you can finally compile your project successfully again.
While this was an answer to my similar issue, if you absolutely have to use Xamarin.XXXXX then this won't fix your issue as you are going to have to use the tools supplied by Android.XXXX.

Compiling and using AppCompatActivity in Eclipse

I have the latest Android Support Library, Android Support Repository and Google Repository (Rev. 23.1, 24, 22 respectively) and working with Eclipse Mars.1(4.5.1)
In the process of giving a make-over to an existing app, I am trying to import the v7.AppCompatActivity library, closing all other projects in workspace and silent prayers. ( ;-) )
Observations:
I daresay I have been unsuccessful even after following the instructions here to the dot.
Ian Lake's blog looks all hunky-dory, but Utopian.
Reading up tons of excellent answers on SO did not yet help. No matter what target is set in the project.properties page or what Build Target is set in the Eclipse Project Properties dialog - just cannot seem to get rid of this (and very similar) compile error(s):
android-support-v7-appcompat\res\values-v23\styles_base.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Going by the number of similar questions, I am surely not alone. Pray, can someone kindly throw some light on how to import the v7 support library without going insane?
Thanks in advance!
None of the answers or blogs pointed out the following, except #pkuszewski.
The above issue resolves on
upgrading to Android 6 Marshmallow API 6.0 with the SDK manager
setting the Build Target for the AppCompat project to Android 6.0
Did I hear, "Duh"? :)
Thanks, #pkuszewski!
SDK Manager fragment looks like this, post the fix:

Why is AdMob integration in my app using Android Studio not working?

I integrated AdMob in my app using Eclipse Juno - it is working fine. But when I tried to integrate it using Android Studio, I get this error:
Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize').
I also added jar file in libs folder. I use minSdk =9 and targetSdk=18. I also changed project.properties file to "target=android-13".
screenSize and smallestScreenSize were only added in API 13. See http://developer.android.com/guide/topics/manifest/activity-element.html#config
I presume you are getting this error when building the app? Change your build config so that you are building against version 13 or up of the SDK.
Check your target api level and minimum api level. i had similar issue before and i solved it like this:
target api level = highest available
minimum api level = 9
I dont know much about Android studio but you can do it from manifest.xml
i hope it helps.

adding android:widgetCategory="keyguard|home_screen" while still supporting older sdk

I am trying to modify my widget so that it supports being placed on 4.2 lockscreens. However I still want to support older SDK's.
I added
android:widgetCategory="keyguard|home_screen"
to my appwidget-provider in res/xml, but eclipse complains that there is "no resource identifier found for attribute widetCategory in package android'
If I raise the minSdkVerion to 17 everything works fine, but I want to still support older SDKs.
I have tried using resource qualifiers creating a separte res/xml-v17/mywidget.xml and only adding the tag there, but the error still appears.
Thanks for any help.
Edit:
I figured it out. using a res/xml-v17/ folder is the answer. I just had to change the build target for my project to 17 / 4.2.
I think that setting targetSdk to 17 is enough. XML elements that do not make sense on older SDKs are simply ignored.
No need to put mywidget.xml into res/xml-v17 folder
Put a copy of your mywidget.xml in res/xml-v17/ folder.
This targets Android 4.2 and all new "properties on the appwidget-provider element will be avaible. Also right click your project in eclipse and change build target to: API level 17/ Android 4.2
I saw your Edit. But i think this makes it more clear that this question have an answer.
UPDATE: I can confirm Tomáš Hubálek answer. the xml-v17 is not needed. Changing Build target is enough. Right click your project in eclipse and change build target to: API level 17/ Android 4.2

Categories

Resources