Maps Application Error - android

I am doing a Google MAPS application in android. I have installed the 2 platforms 2.3.3 and 2.1 and corresponding the Google API also.I have got the Google Maps API key.I have Added the permissions in manifest file also.For this application I used Google API 2.1 for Build SDk and Android 2.1 for MinSDK version.But when I run the project it shows a warning in Console
Ignoring platform 'android-8': build.prop is missing .
Also an error on the API KEY I pasted on the main.xml file ( android:apikey = ) is
error: Error parsing XML: not well-formed (invalid token)
main.xml file code is
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.google.android.maps.MapView
android:id="#+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="<MYAPIKEY>" />
</LinearLayout>
I have no error in Main activity.How can I solve this problem ?

The API key shouldn't have the < and > characters in it.

Related

"fate of the processing instruction" error in google_maps_api.xml [duplicate]

This question already has answers here:
Error: The processing instruction target matching "[xX][mM][lL]" is not allowed
(10 answers)
Closed last month.
I am new to this forum and in general in android development. I wish to help solve a problem that I have when running the app. The app I'm developing now is based on an activity of google maps. I've done all steps as creating credentials in google api developers and copy the key to xml and manifest. When I run the app I get this error:
Error: (2, 10) Error: The fate of the processing instruction that matches" [xX] [mM] [lL] "is not allowed. App: mergeDebugResources FAILED
What I'm trying for now is just to run the app and show me the google maps
This is google_maps_api.xml:
<resources><string name="google_maps_key" translatable="false" templateMergeStrategy="preserve">AIzaSyDtbq2HdPj5VpKCCvhj1vbuUaA1HIAz8Gg</string>
<?xml version="1.0" encoding="utf-8" ?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:name="com.google.android.gms.maps.MapFragment"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"/></resources>
I also faced the same problem in one of my android projects.
in my case, it is coming from the AndroidManifest.xml. because I added
<?xml version="1.0" encoding="utf-8"?>
in the starting of the file
this line should not be there in the file . and I resolve it by removing the
line.
In your case also you have the line in the AndroidManifest.xml file. So remove it. I think it will solve your problem.

How can I use the Android library ExtendedCalendarView

I am new in Android-Programming and I and my programmer team have to program a little app for our college. So we need the ExtendedCalendarView-Library and we already imported it in our AndroidStudio-project but we always get the same failure:
Can not find the following classes com.tyczj.extendedcalendarview.ExtendedCalendarView
try to fix Build Path
and so on.
Code in our test.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<com.tyczj.extendedcalendarview.ExtendedCalendarView
android:layout_width="match_parent"
android:layout_height="match_parent">
</com.tyczj.extendedcalendarview.ExtendedCalendarView>
</RelativeLayout>
But we have imported another library at the same way and it works. We also get a suggestion from com.tyczj.extendedcalendarview.ExtendedCalendarView when we open the '<' in a .xml file but always the same failure.
Meanwhile time is pressing so we have not so much time anymore.
Could anyone help us?
Have you copied the provider tag in your android manifest if not then copy it in application tag of AndroidManifest:
<application>
...
<provider
android:name="com.tyczj.extendedcalendarview.CalendarProvider"
android:authorities="com.tyczj.extendedcalendarview.calendarprovider" />
</application>

Error inflating class com.google.android.ads.AdView

I've got quite weird problem with new AdView creation in layout XML while migrating from old AdMob.
OK.
Product target- Google API 19
Default properties- Google API 8
google play lib is referenced in the project and seems to be dexed and then included into resulting apk (proof is below).
I have the following code in my layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.android.gms.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0"
android:orientation="vertical" >
...
<com.google.android.gms.ads.AdView
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
ads:adSize="BANNER"
ads:adUnitId="#string/admob_unit_id"
/>
When I load the layout I've got the exception.
I see the following suspicious things:
I have specially put code which uses AdView BEFORE the XML loading and have no exception there
com.google.android.gms.ads.AdView ad= new com.google.android.gms.ads.AdView(this);
try
{
setContentView(R.layout.ap_map);
}
catch(RuntimeException e)
{
throw e;
}
So, I assume that there is no prob with google play library inclusion itself.
However, when I debugged the exception- I've got an internal exception- NoClassDefFoundException, so it looks exactly like I have google play lib missed
I have weird probs with AdView declaration- if I declare it as google suggest
I've got an error saying that
- error: No resource identifier found for attribute 'adSize' in package MYPACKAGE
So I had to add
xmlns:ads="http://schemas.android.com/apk/lib/com.google.android.gms.ads"
in the top of the layout declaration to get rid of this
Any ideas? I've read a few related topics here and all of them seems to be related with google play lib absence but it does not seem to be the case
Change :
xmlns:ads="http://schemas.android.com/apk/lib/com.google.android.gms.ads"
to:
xmlns:ads="http://schemas.android.com/apk/res-auto"

widget previewImage attribute on API 8

I have defined a widget provider xml in my app as below :
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="40dp"
android:minHeight="40dp"
android:updatePeriodMillis="43200000"
android:initialLayout="#layout/widget"
android:previewImage="#drawable/ic_widget_on"
>
</appwidget-provider>
But Eclipse shows me a warning :
Attribute "previewImage" is only used in API level 11 and higher (current min is 8)
So, to remove this warning while supporting API 8, i define a custom namespace and use that for the previewImage attribute as below :
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myApp="http://schemas.android.com/apk/res-auto"
android:minWidth="40dp"
android:minHeight="40dp"
android:updatePeriodMillis="43200000"
android:initialLayout="#layout/widget"
myApp:previewImage="#drawable/ic_widget_on"
>
</appwidget-provider>
But now Eclipse shows me the error :
error: No resource identifier found for attribute 'previewImage' in package 'com.myDomain.myApp'
Usually this solution works for other newly introduced attributes when using the support library. But why is it not working for previewImage? Doesn't the support library support it?
But Eclipse shows me a warning
That warning should not affect anything of note. Preview images were not used by the platform at all prior to API Level 11.
Usually this solution for other newly introduced attributes when using the support library.
App widgets are not part of the support library.

XML error - Doing Google Android NDK Lesson 1

The Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:weightSum="1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<EditText android:id="#+id/edit_message"
android:layout_weight = "1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="#string/edit_message" />
<Button
android:id="#+id/bSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/button_send" />
</LinearLayout>
The error message:
BUILD FAILED
C:\My First App\res\layout\activity_main.xml:7: Unexpected element "{}LinearLayout" {antlib:org.apache.tools.ant}LinearLayout
The code is almost exactly the same as the code on the Android website and it's really frustrating that I can't seem to get it to work. Is the problem in the code, or is it on my side? I am using Eclipse
I was getting the same error. I was using Indigo in Ubuntu 12.04, and no matter what libraries I got or eclipse plugins I used it was always there.
What worked for me was re-downloading and reinstalling the Android SDK (probably not necessary in your case), and downloading Eclipse Classic (Juno) from the Eclipse website rather than using the Indigo package that was in the repos. The lesson said Classic was recommended anyway, so whatever, I'm just happy it works now.
If you are using Windows, I'd still suggest downloading the most recent Classic version, but otherwise I can't be of help there.

Categories

Resources