Flutter Android Splash screen errors - android

I'm looking to simply added a splash screen to my Android app built in Flutter. I want a red screen with an image in the centre. I have the following in Android:
color.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name = "crimson">#D272638</color>
</resources>
launch_background.xml:
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#color/crimson" />
<!-- You can insert your own image assets here -->
<item>
<bitmap
android:gravity="center"
android:src="#drawable/logo" />
</item>
</layer-list>
My file structure is as follows:
Every time I try run the app I get the following error:
Execution failed for task ':app:mergeDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
path-to-app/android/app/src/main/res/values/colors.xml:3:5-43: AAPT: error: invalid color.
path-to-app/build/app/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml: AAPT: error: file failed to compile.
Why would creating a color for a splash screen crash and app?

For the next soul that finds themselves stuck in this situation, the problem I experienced above was because I was using capital letters in my colors.xml file. Just make all the characters lower case and you are good to go.

Related

Error: Unsupported type 'holder'

I am trying to run an Application that I downloaded the source code from the internet and having problems.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item
type="holder"
name="id_name" />
<item
type="categorie"
name="id_name" />
</resources>
The error I get is
app\src\main\res\values\id2.xml: Error: Unsupported type 'holder'' and cannot resolve symbol 'holder'.
How do I get over this?
It is because you can use only below types in an item tag.
And types can contain a reference for above-listed values.

Error: No resource identifier found for attribute 'showsAsAction' in package 6

I want to add profil opportunity to my action bar,but if i runt it doesnt work,I change shiwsAsAction from always to never, but it also didnt work.. i get this message in grade build:
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
C:\Android\Celtkituzes_0_1\app\src\main\res\menu\menu.xml
Error:(7) No resource identifier found for attribute 'showsAsAction' in package 'sgtt.celtkituzes_0_1'
C:\Android\Celtkituzes_0_1\app\build\intermediates\res\merged\debug\menu\menu.xml
Error:(7) No resource identifier found for attribute 'showsAsAction' in package 'sgtt.celtkituzes_0_1'
Warning:The android.dexOptions.incremental property is deprecated and it has no effect on the build process.
menu xml:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:appname="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="#+id/item_profil"
android:icon="#drawable/ic_action_image_timer_auto.png"
android:title="Profil"
app:showsAsAction="never">
</item>
</menu>
it should be android: not app:
should be showAsAction not showsAsAction
You have letter s attached to show
EDIT
For your next problem: You have to put an image also into drawabe folder, not only in one of the xxxhdpi(or similar) folders.
The error described:
Error: No resource identifier found for attribute 'showsAsAction'
is caused because the property must be app:showAsAction (not showsAsAction)
And the extension for the image file is not neccesary just the name:
android:icon="#drawable/ic_action_image_timer_auto"
This must be your menu.xml file :
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:appname="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="#+id/item_profil"
android:icon="#drawable/ic_action_image_timer_auto"
android:title="Profil"
app:showAsAction="never">
</item>
</menu>

Issue: Implementing app restrictions and Lint Errors in app_restrictions.xml

I am working on Android MDM and have the app_restrictions.xml file under /src/main/res/xml/ folder. The MDM I am using is not showing me the value of the restriction, not even the default value. All the steps mentioned in this link has been followed to set app restrictions: https://developer.android.com/training/enterprise/app-restrictions.html
but i am getting Bundle[EMPTY_PARCEL]. below is the code
app_restrictions.xml
<?xml version="1.0" encoding="utf-8"?>
<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
<restriction
android:key="MDMEmailKey"
android:title="Email"
android:restrictionType="string"
android:description="#string/email_address_mdm_description"
android:defaultValue="testtesttest#gmail.com" />
<restriction/>
</restrictions>
Also, the lint is showing me below errors, though I was able to suppress it in gradle through lint options, but just wondering if it is not the cause of the issue I am facing. Please let me know why I am getting these errors.
Executing task ':project_name:lintVitalRelease' (up-to-date check took 0.0 secs) due to:
Task has not declared any outputs.
.../src/main/res/xml/app_restrictions.xml:8: Error: Missing required attribute android:key [ValidRestrictions]
<restriction/>
~~~~~~~~~~~~~~
.../src/main/res/xml/app_restrictions.xml:8: Error: Missing required attribute android:restrictionType [ValidRestrictions]
<restriction/>
~~~~~~~~~~~~~~
.../src/main/res/xml/app_restrictions.xml:8: Error: Missing required attribute android:title [ValidRestrictions]
<restriction/>
~~~~~~~~~~~~~~
Explanation for issues of type "ValidRestrictions":
Ensures that an applications restrictions XML file is properly formed
https://developer.android.com/reference/android/content/RestrictionsManager.html
3 errors, 0 warnings
RE: The lint errors
You have an empty restriction element at line 8 <restriction/>
Just remove it and the lint errors will go away.
<?xml version="1.0" encoding="utf-8"?>
<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
<restriction
android:key="MDMEmailKey"
android:title="Email"
android:restrictionType="string"
android:description="#string/email_address_mdm_description"
android:defaultValue="testtesttest#gmail.com" />
<restriction/> <!-- Error here -->
</restrictions>

android eclipse can't see layer-list in Graphical Layout

i'm trying to build a layer-list of 2 images and to see it in the Graphical layout in eclipse in order to see that it came correctly...
for some reason i get an error
this is my xml file:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="50dp"
android:layout_height="50dp">
<item android:drawable="#drawable/picuser"
android:layout_width="50dp"
android:layout_height="50dp"/>
<item android:drawable="#drawable/ic_launcher"
android:layout_width="50dp"
android:layout_height="50dp"/>
</layer-list>
this is my error:
NOTE: This project contains Java compilation errors, which can cause rendering failures
for custom views. Fix compilation problems first.
com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup
Exception details are logged in Window > Show View > Error Log
The following classes could not be found:
- item (Fix Build Path, Edit XML)
- layer-list (Fix Build Path, Edit XML)

Hello Views/Form Stuff/Custon Button tutorial error

Flush with success on getting "hello Android" to run, I'm working on the tutorial at link text using Eclipse. When I create the android_button.xml file in res/drawable/, I get errors for each of the in
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#drawable/android_pressed"
android:state_pressed="true" />
<item android:drawable="#drawable/android_focused"
android:state_focused="true" />
<item android:drawable="#drawable/android_normal" />
</selector>
The errors (repeated for each item) are:
Description Resource Location Type Path
error: Error: No resource found that matches the given name (at 'drawable' with value '#drawable/android_focused'). android_button.xml line 5 Android AAPT Problem /HelloFormStuff/res/drawable
error: Error: No resource found that matches the given name (at 'drawable' with value '#drawable/android_focused'). android_button.xml line 5 Android AAPT Problem /HelloFormStuff/res/drawable
I'm afraid I don't know which resource should match the names or if I have overlooked something or misnamed something. Help resolving this is greatly appreciated!
You probably missed this line in the instructions:
Copy the images on the right into the res/drawable/ directory of your project. These will be used for the different button states.
Just copy those little android icons into the directory and it should work
On the link you gave there are three android icons near
android_button.xml code. Just right click them and "save as"
Save them in your res/drawable directory along with android_button.xml.
note that I assume you are creating that xml file in res/drawable directory
and note in drawable-XXXX directory created by eclipse. You will have to manually
create a new folder drawable in res directory, since its not default eclipse stuff.

Categories

Resources