I have been messing around with this for a few days now and have the code identical to that in the tutorial and yet it still doesn't want to work, Why?
MainActivity.java
package com.example.mdpmk1;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.view.View;
import android.view.View.OnClickListener;
public class MainActivity extends Activity {
Button button;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
addListenerOnButton();
}
public void addListenerOnButton() {
final Context context = this;
button = (Button) findViewById(R.id.scan);
button.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
Intent intent = new Intent(context, ScanScreen.class);
startActivity(intent);
}
});
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Screen One......"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Button
android:id="#+id/scan"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Click me to another screen" />
</LinearLayout>
ScanScreen.java
package com.example.mdpmk1;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
public class ScanScreen extends Activity {
Button button;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.scan_screen);
}
}
scan_screen.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="You have done it!!"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
AndroidMainfest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.firstapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.firstapp.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>
</application>
</manifest>
Any help would be lovely, This has relay been annoying me and i know that it is probably a simple mistake.
Add the following in your AndroidManifest.xml
<activity android:name=".ScanScreen" />
within application like so:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.firstapp.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>
<activity android:name=".ScanScreen" />
</application>
Here is a quote from the official docs on what the activity tags are for:
Declares an activity (an Activity subclass) that implements part of
the application's visual user interface. All activities must be
represented by elements in the manifest file. Any that are
not declared there will not be seen by the system and will never be
run.
That last sentence is important.
In your case writing <activity android:name=".ScanScreen" /> above </application> will solve your problem.
Whenever you need to use any activity in android you have to mention it in AndroidManifest.xml file. Just giving answer to you won't help you.
You should first read on below links to understand what is intent and intent-filters used for.
http://developer.android.com/reference/android/content/Intent.html
http://developer.android.com/guide/components/intents-filters.html
What is an Intent in Android?
Your app crashes because your not setting or registered the activity in manifest.You haven't added the ScanScreen Activity in your manifest file.
Just add the following to your AndroidManifest.xml :
<activity android:name=".ScanScreen" />
within your application tag like this:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.firstapp.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>
<activity android:name=".ScanScreen" />
</application>
Related
My AndroidManifest file is showing an error "Unresolved class 'MainActivity' ", but i have a java class and file by that name in the package and it is supposed to be the first activity of the program so when i try to run the program it crashes up , i've checked my code but couldn't find any problem there .
java code for MainActivity file
package com.example.tictactoe;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.widget.Button;
import android.content.Intent;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
Button forward;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
forward = (Button)findViewById(R.id.start);
forward.setOnClickListener(new View.OnClickListener()
{
#Override
public void onClick(View v)
{
startActivity(new Intent(MainActivity.this,GameUi.class));
}
});
}
#Override
public void onBackPressed() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(false);
builder.setMessage("Do you want to Exit?");
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
builder.setNegativeButton("No",new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
AlertDialog alert=builder.create();
alert.show();
}
}
java code for second activity which my program uses ("GameUi.java")
package com.example.tictactoe
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.view.View;
import android.widget.Button;
import android.os.Bundle;
public class GameUi extends AppCompatActivity {
Button btn;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_game_ui);
btn=(Button)findViewById(R.id.backbtn);
btn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
startActivity(new Intent(GameUi.this, MainActivity.class));
}
});
}
}
AndroidManifest file code
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.tictactoe">
<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.TicTacToe">
<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=".GameUi">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
MainActivity xml file code
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#E5E6AD"
tools:context=".MainActivity">
<TextView
android:id="#+id/Heading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_row="0"
android:layout_column="0"
android:layout_marginBottom="332dp"
android:editable="false"
android:text="Hello Aliens!"
android:textAlignment="center"
android:textColor="#000000"
android:textSize="50dp"
android:textStyle="bold|italic"
app:layout_constraintBottom_toBottomOf="parent"
tools:layout_editor_absoluteX="16dp" />
<ImageView
android:id="#+id/Alienimg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="36dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#id/Heading"
app:srcCompat="#drawable/ic_launcher_foreground" />
<Button
android:id="#+id/Startbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#000066"
android:letterSpacing="0.5"
android:padding="0dp"
android:text="Start"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/Alienimg"
app:layout_constraintVertical_bias="0.886" />
</androidx.constraintlayout.widget.ConstraintLayout>
In your class's I don't see the package at top.
Try adding it and see, if you still face the issue, try invalidate and restarting.
package com.example.tictactoe;
This is the cause of error
<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=".GameUi">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
the intent-filter is used to define that which activity will be your first activity ( when you start your Android Application ). You can use it in both activities so the App will confuse which is your first Activity so they give error.
In case MainActivity is your first activity
<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=".GameUi">
</activity>
Your manifest is Ok ( I guess you fixed the intent-filter issue based on
Abdullah Sheikh answer). the problem is because of this line in MainActivity :
forward = (Button)findViewById(R.id.start);
because your button id is Startbtn not start
just replace that with :
forward = (Button)findViewById(R.id.Startbtn);
also in activity_main and ImageView remove
app:srcCompat="#drawable/ic_launcher_foreground"
or find another src for drawable.
I'm having issues getting an sms text to send. When I click the button, nothing happens. No message or anything.
What doesn't make sense is that it works as a standalone app for sms sending, but if I integrate the code into my larger project, it doesn't send the sms. Nothing happens.
Something has to conflicting with Smsmanager or something. Can anyone give me advice on why it doesn't work anymore?
Android Manifest
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android_auto">
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application android:allowBackup="true" android:icon="#mipmap/ic_launcher" android:label="#string/app_name"
android:supportsRtl="true" android:theme="#style/AppTheme">
<activity android:name=".engine.MainActivity" android:label="#string/app_name" android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ui.MapsActivity1">
</activity>
<meta-data android:name="com.google.android.gms.car.application" android:resource="#xml/automotive_app_desc" />
<meta-data android:name="com.google.android.geo.API_KEY" android:value="AIzaSyCMFYfJ6aOuxJk3W0vmhF6Nou3TP_qIU6c" />
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<!--
Main music service, provides media browsing and media playback services to
consumers through MediaBrowserService and MediaSession. Consumers connect to it through
MediaBrowser (for browsing) and MediaController (for playback control)
-->
<service android:name=".MyMusicService" android:exported="true">
<intent-filter>
<action android:name="android.media.browse.MediaBrowserService" />
</intent-filter>
</service>
<service android:name=".MyMessagingService" />
<receiver android:name=".MessageReadReceiver">
<intent-filter>
<action android:name="com.example.zachboone.myapplication.ACTION_MESSAGE_READ" />
</intent-filter>
</receiver>
<receiver android:name=".MessageReplyReceiver">
<intent-filter>
<action android:name="com.example.zachboone.myapplication.ACTION_MESSAGE_REPLY" />
</intent-filter>
</receiver>
</application>
</manifest>
SendSmsActivity.java
package android_auto.engine;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import android_auto.R;
public class SendSmsActivity extends Activity {
Button buttonSend;
EditText textPhoneNo;
EditText textSMS;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sms);
buttonSend = (Button) findViewById(R.id.buttonSend);
textPhoneNo = (EditText) findViewById(R.id.editTextPhoneNo);
textSMS = (EditText) findViewById(R.id.editTextSMS);
buttonSend.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
String phoneNo = textPhoneNo.getText().toString();
String sms = textSMS.getText().toString();
try {
SmsManager smsManager = SmsManager.getDefault();
PendingIntent pendingIntent = PendingIntent.getBroadcast(SendSmsActivity.this, 0, new Intent("SMS_SENT"), 0);
smsManager.sendTextMessage(phoneNo, null, sms, pendingIntent, null);
Toast.makeText(getApplicationContext(), "SMS Sent!",
Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(getApplicationContext(),
"SMS faild, please try again later!",
Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}
});
}
}
activity_sms.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/textViewPhoneNo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter Phone Number : "
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="#+id/editTextPhoneNo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:phoneNumber="true" >
</EditText>
<TextView
android:id="#+id/textViewSMS"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter SMS Message : "
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="#+id/editTextSMS"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:lines="5"
android:gravity="top" />
<Button
android:id="#+id/buttonSend"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Send" />
</LinearLayout>
Try editing your code in click listener to this
PendingIntent pendingIntent = PendingIntent.getBroadcast(SendSmsActivity.this, 0,new Intent("SMS_SENT"), 0);
smsManager.sendTextMessage(phoneNo, null, sms, pendingIntent, null);
Hope this helps you making it working.
I am developing a game in libgdx. I read the official docs and tried to integrate MobClix Ads in my App but eclipse can't resolve this constructor for ADView class: (for Example):
AdView ad = new AdView(this, AdSize.BANNER, "a14d91b10f12454");
This line of code give me an error.
Maybe my import is not correct? I import this:
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;
And the same for:
adView.loadAd(new AdRequest());
I tried to search for an answer but I coudn't find, Does somone know how to resolve this?
Sorry for my poor english.
Put this code to mainactivity
import android.app.Activity;
import android.os.Bundle;
import com.startapp.android.publish.StartAppAd;
public class MainActivity extends Activity {
private StartAppAd add = new StartAppAd(this);
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
StartAppAd.init(this, "105158220", "205151606");
//StartAppSearch.init(this, "105158220", "205151606");
setContentView(R.layout.activity_main);
if(add.isReady())
{
add.showAd(); // show the ad
add.loadAd();
}
//a.loadAd(AdMode.FULLPAGE);
}
#Override
public void onResume(){
super.onResume();
add.onResume();
}
#Override
public void onBackPressed() {
add.onBackPressed();
super.onBackPressed();
}
#Override
public void onPause() {
super.onPause();
add.onPause();
}
}
put this into your xml file
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<com.startapp.android.publish.banner.banner3d.Banner3D
android:id="#+id/startApp3DBanner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
put this into ur Manifest file
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.GET_TASKS" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.start_up_app.MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation"
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="com.startapp.android.publish.list3d.List3DActivity"
android:taskAffinity="com.example.start_up_app.AppWall"
android:theme="#android:style/Theme" />
<activity
android:name="com.startapp.android.publish.AppWallActivity"
android:configChanges="orientation|keyboardHidden"
android:taskAffinity="com.example.start_up_app.AppWall"
android:theme="#android:style/Theme.Translucent" />
</application>
</manifest>
for you have to use StartAppCommon-1.0.1.jar and StartAppInApp-2.0.7.jar
I have an application with AdMob advertisement. I have created an account and have an application_id. It is all right, the application sends requests for server, server fixes it. But the application doesn't show me a banner. My code:
main.xml:
<?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:id="#+id/linear"
android:orientation="vertical" >
</LinearLayout>
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nda.ad"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:label="#string/app_name"
android:name=".AdmobActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>
</manifest>
And code of my activity:
package com.nda.ad;
import com.google.ads.AdRequest;
import com.google.ads.AdSize;
import com.google.ads.AdView;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
public class AdmobActivity extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
LinearLayout layout = (LinearLayout)findViewById(R.id.linear);
// Create the adView
// Please replace MY_BANNER_UNIT_ID with your AdMob Publisher ID
AdView adView = new AdView(this, AdSize.BANNER, "a14eb6c98335a35");
// Add the adView to it
layout.addView(adView);
// Initiate a generic request to load it with an ad
AdRequest request = new AdRequest();
request.setTesting(true);
adView.loadAd(request);
}
}
Where have I made a mistake?
i have a little trouble with the android mapview. It simply crashes every time i try to open the app!
Code:
package com.jappapps.android.travelbuddy;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
public class TravelBuddy extends MapActivity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main); // changed to lowercase
MapView mapView = (MapView) findViewById(R.id.mapview); // match id in main.xml
mapView.setBuiltInZoomControls(true);
}
#Override
protected boolean isRouteDisplayed() {
return false;
}
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jappapps.android.travelbuddy"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".TravelBuddy"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="3" />
<uses-library android:name="com.google.android.maps" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>
Main.xml
<?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
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="0QrW-CcUIzU_fxIS_9O-BkFnuPC-rTj-7t3Q0xw"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/hello"
/>
</LinearLayout>
The <uses-library android:name="com.google.android.maps" /> line should be inside the <application> tags