I am struggling with resolving this resource error in xml - android-layout

I have been struggling with this error for 2 days now and i am at wits end.
building this project in eclipse.according to the sdk this png does not need to be imported. i imported into my drawables anyway after this error generated to no avail.
is anybody willing to point me in the right direction here?
Error: No resource found that matches the given name (at 'icon' with value '#android.drawable/ic_menu_add').
W/ResourceType( 1020): Bad XML block: header size 62 or total size 9767704 is larger than data size 0
//*list_menu.xml
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#+id/menu_insert"
android:icon="#android.drawable/ic_menu_add"
android:title="#string/menu_insert"
/>
</menu>
//*strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, ReminderListActivity!</string>
<string name="app_name">Task Reminder</string>
<string name="no_reminders">No Reminders Yet</string>
<string name="title">Title</string>
<string name="body">Body</string>
<string name="date">Date</string>
<string name="time">Time</string>
<string name="confirm">Confirm</string>
<string name="menu_insert">Add Reminder</string>
</resources>
//*AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dummies.android.taskreminder"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<application android:icon="#drawable/icon"
android:label="#string/app_name" android:debuggable="true">
<activity android:name=".ReminderListActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ReminderEditActivity"
android:label="#string/app_name"/>
</application>
</manifest>

Try changing
android:icon="#android.drawable/ic_menu_add"
to
android:icon="#android:drawable/ic_menu_add"
I believe you need a : not a .

Related

I have got these error in my Manifest file. Any solution?

Error: tools:replace specified at line:8 for attribute
android:appComponentFactory, but no new value specified RestfulAPI.app
main manifest (this file), line 7 Error
Validation failed, exiting
RestfulAPI.app main manifest (this file)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.restfulapi">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.RestfulAPI"
tools:replace="android:appComponentFactory">
<activity
android:name=".DataViewActivity"
/>
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
add this line in your application tag.
tools:replace="android:appComponentFactory"
android:appComponentFactory="#string/application _name"

AndroidStudio says Could not identify launch activity: Default Activity not found"

The app works as expected. - it is only the IDE that apparently fail to upload/run it.
05/15 14:37:53: Launching 'app' on Google Glass 1. Install
successfully finished in 1 s 954 ms. Could not identify launch
activity: Default Activity not found Error while Launching activity
My manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="no.ut.glassbrowser"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name">
<activity
android:immersive="true"
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="#xml/voice_trigger" />
</activity>
</application>
</manifest>
What Am I missing?
In your "intent-filter" tag you should have this code
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />

Failed to parse XML in Android Manifest after update

I have an app I was working on a few months ago. Today I opened it again in Android Studio 3.4 and when syncing it asked if OK to upgrade to the current version of Gradle and the Gradle plug-in. I agreed and I now get an XML parsing error in the manifest.
The manifest is here, I added a comment to signal where I get the error:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.schalkx.alarmapp01">
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.AppCompat">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SetAlarmActivity">
android:label="Alarm Settings"
android:parentActivityName=".MainActivity" <!-- *** I GET THE ERROR HERE *** -->
<!-- Parent activity meta-data to support 4.0 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>
<activity android:name=".ShowClockActivity">
android:label="Desktop Clock"</activity>
<receiver android:name=".AlarmReceiver" />
<activity
android:name=".UserResponseActivity"
android:label="#string/title_activity_user_response" />
<meta-data
android:name="preloaded_fonts"
android:resource="#array/preloaded_fonts" />
</application>
</manifest>
I did some tests adding a new activity and I noticed that the syntax is now generated a bit differently, and would start like this:
<activity
android:name=".SetAlarmActivity"
android:label="Alarm Settings"
android:parentActivityName=".MainActivity"
....
That is, the ">" is not added at the end of
<activity android:name=".SetAlarmActivity">
but later on. Trouble is I haven't been able to get the syntax right.
Any ideas what's wrong?
Thanks!
It should be
<activity android:name=".SetAlarmActivity"
android:label="Alarm Settings"
android:parentActivityName=".MainActivity"> //<--Notice
Instead of
<activity android:name=".SetAlarmActivity"> //<--Notice
android:label="Alarm Settings"
android:parentActivityName=".MainActivity"

Google Maps not working trying for 3 days

I have done everything according to this page:-https://developers.google.com/maps/documentation/android/start
But i only see a blank grey page with Google logo and +/- sign. Some people say my API key is wrong but i have generated my API key a 100 times but still no luck. My code is the same as provided on Google developer page. I have given the link above. I am done trying everything now please someone help me.
This is my java code:-
package com.example.gps;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
This is my xml layout code:-
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
This is my manifest code:-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.gps"
android:versionCode="1"
android:versionName="1.0" >
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyA0aKSCV1vZXmJN4Xht440rDWu8NWqrgD0" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
Also it is working on my emlator but not my device
Finally found the solution people.
When you export your apk make sure you export it with debug.keystore.
i.e., The same SHA1 signature which you registered with Google API console.

How to enable a smartphone sized Android application on larger screens

My problem can be summed up in one picture which can be see in this location:
http://imgur.com/qOiyl
The application had originally been developed for smartphone, and on a small resolution there is no problem, the application fills the whole screen. But in tablet, as you can see, only the size corresponding to a smartphone is used.
I guess that this means that somewhere the height and width values are hard set. But I cannot see where! Where is it possible to set height and width for all the application (all activities are doing the same thing).
Here is my AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dombox.app"
android:versionCode="11"
android:versionName="2.0.4" >
<uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" >
</uses-permission>
<uses-permission android:name="android.permission.INTERNET" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" >
</uses-permission>
<application
android:icon="#drawable/icon"
android:label="#string/app_name" >
<activity
android:name=".activity.DomboxHome"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="android.test.runner" />
<activity
android:name=".activity.list.ZonesList"
android:label="#string/app_name" >
<intent-filter>
<action android:name="Dombox.MENU" />
</intent-filter>
</activity>
<activity
android:name=".activity.list.EquipementsList"
android:label="#string/app_name" >
</activity>
<activity
android:name=".activity.PullToRefreshActivity"
android:label="#string/app_name" >
</activity>
<activity android:name="org.achartengine.GraphicalActivity" />
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:label="Tests for Android Dombox"
android:targetPackage="com.application.androiddombox" >
</instrumentation>
<activity
android:name=".activity.list.SuiviConsoList"
android:label="#string/app_name" >
</activity>
<activity android:name=".activity.list.PlanningList" android:label="#string/app_name"></activity>
</application>
And here is one of mine layout (there are all in the folder /res/layout/)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<fragment
android:name="com.dombox.app.fragment.MenuFragment"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:id="#+id/menu_fragment"
android:layout_weight="30">
<!-- Preview: layout=#layout/list_text -->
</fragment>
<fragment
android:name="com.dombox.app.fragment.SettingsFragment"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:id="#+id/settings_fragment"
android:layout_weight="70">
<!-- Preview: layout=#layout/settings -->
</fragment>
</LinearLayout>
Do you have any idea?
I think your app is running in compatibility mode, Put this piece of code just before the <application> tag in your manifest file.
<supports-screens android:largeScreens="true"
android:normalScreens="true" android:smallScreens="true"
android:anyDensity="true" android:xlargeScreens="false" />
Hope that works,
I think you need to set android:weightSum="100" to your LinearLayout
You can try to add
<supports-screens android:xlargeScreens="true" />
in AndroidManifest.xml. This tells the system that your app is compatible with xlarge screens (tablets), and that your app should be stretch to fill screen.
Yes you are obviously missing one of the important stuff.
There is no supports-screen tag in your manifest file, so by default "normalScreens" is set to true and all others false.
Here is the link for more info on Supporting Multiple Resolution.
Also check this link

Resources