New developer but I have spent the past few days trying to resolve this problem of gray boxes showing up instead of a map on Android device.I have read just about everything there is to read about these boxes but the solutions that are working for other people are not working for me.
The api key that I am using comes from keytool in my java JRE 7 folder using the command from bin folder:
keytool -list -alias androiddebugkey -keystore "C:\Users\ben.android\debug.keystore" -storepass android -keypass android -v
.... I believe this is the debug API key that I have read about here as well as other places.
Here is the error I am getting http://imgur.com/IoHMHQc. I believe I have highlighted the "interesting" part which is java.io.IOException: Server returned: 3.
It seems like that means my API key is faulty but I have made multiple new ones and none seem to fix the problem!
I am NOT uploading the application yet so I don't think the "signed/unsigned" exporting matters but that is because I don't understand it completely.
I have tried following multiple tutorials such as one from Lynda.com as well as various youtube tutorials, however they all are Google Maps v2 rather than v3 so that may be the issue. Help would be greatly appreciated and lifesaving!
Here is my main java file:
package com.bentseytlin.gmap2;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends MapActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MapView view = (MapView) findViewById(R.id.themap);
view.setBuiltInZoomControls(true);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
#Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
Here is my 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.google.android.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/themap"
android:clickable="true"
android:apiKey="AIzaSyB1gqlqGQZCH1TlrDhp5BP9Pm9k4Jm_2co"
/>
</RelativeLayout>
And here is my Manifest File:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bentseytlin.gmap2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<uses-library android:name="com.google.android.maps"/>
<activity
android:name="com.bentseytlin.gmap2.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>
Thanks again!
Make sure you have followed all the steps in the below link
https://developers.google.com/maps/documentation/android/start. (api v2)
You should refer to google services library project in your map project
Download the Google Play services.Goto Windows. Goto Android Sdk Manager. Choose Google play services under extras. If not installed install the package.
Copy the google-play services_lib library project to your workspace. The library project can be found under the following path.
<android-sdk-folder>/extras/google/google_play_services/libproject/google-play-services_lib library project .
Import the library project to your eclipse.
Click File > Import, select Android > Existing Android Code into Workspace, and browse the workspace import the library project. You can check if it is library project. Right click on the library project. Goto properties. Click Android on the left panel. You will see Is Library checked.
To refer to the library project
Right click on you android map project. goto properties. Choose Android. Click Add borwse and add the library project.
Assuming you have the key.
Make sure you have enabled google maps for android in the google api console under the services tab.
Your min sdk is 10. You should use Support Fragment.
<fragment
class="com.google.android.gms.maps.SupportMapFragment"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
Your activity must extend FragmentActivity
SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
GoogleMap mMap = fm.getMap();
Make sure you have added support library
Also make sure you imported the below
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.maps.SupportMapFragment;
Add these in manifest file
<permission
android:name="com.bentseytlin.gmap2.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.bentseytlin.gmap2.permission.MAPS_RECEIVE"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
Add the key in manifest under application tag
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="key"/>
You are trying to use Google Maps Android API v1, which is deprecated since december 2012 and will not work for new projects since march 2013.
The easiest way to switch to API v2 is by 1) removing all your code related to maps, 2) following instructions here: https://developers.google.com/maps/documentation/android/start.
Related
I am trying to create a Hello World app using Phonegap but it crashes when I call run the application on emulator. I followed the guideline here. Here is what I have on MainActivity.java :
package com.example.hello;
import android.os.Bundle;
import org.apache.cordova.*;
public class HelloWorld extends CordovaActivity
{
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.init();
// Set by <content src="index.html" /> in config.xml
super.loadUrl(Config.getStartUrl());
//super.loadUrl("file:///android_asset/www/index.html");
}
}
Here is my AndroidManifest.xml :
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="adjustPan" package="com.example.hello" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="#string/app_name" android:launchMode="singleTop" android:name="HelloWorld" android:theme="#android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="20" />
</manifest>
Here is the first errors I get :
Chromium WebView does not exist
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.example.deneme/com.example.deneme.MainActivity}:
java.lang.UnsupportedOperationException
Can you tell me what is wrong with the application? Thanks.
Actually, not every Android phone ships with Chromium as WebView engine (https://developer.chrome.com/multidevice/webview/overview). For instance, my Samsung Galaxy Ace2 with Android 4.1.2 has old WebView engine. User agent string denotes some unknown Mozilla version, HTML5 apps look&feel and behavior differs from Chrome. However, PhoneGap apps do not raise errors on my phone.
I don't know why you're getting "Chromium WebView does not exist" error, but since you're on the very beginnig on your way (cause you're trying to build Hello World app using Phonegap) I want to point to another option. Using Crosswalk project allows you not to deal with various WebView engines on every android device but use embedded in your app chromium engine - always the same on every android device. The crosswalk project is available for android and tizen platforms. So to build crossplatform app (android an iOS) I would suggest to use either
Intel XDK, which can use single html5 source code with XDK api and Cordova api, that can be compiled to android app using crosswalk or compiled to iOS using native WebView.
Crosswalk+Cordova to build android app and PhoneGap to build iOS app from the same sources
This approach can eliminate pain on supporting various android devices.
See also:
http://html5hub.com/building-cordova-applications-with-crosswalk/
https://groups.google.com/forum/#!topic/phonegap/IxSuRUScbMs
I am making a simple map application but on running it, errors are displayed which i don't understand....
my project min SDK is android 2.2(Froyo) API 8 , target SDK is android 4.4(kitkat) API 19 and app is compiled with Google API 2 rev 8.....
I really don't know what should be the combinations of min, target and compiled apis in order to make my app run ....help me out with the proper combination.
following is my manifest file code
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.margallahillhikedroid"
android:versionCode="1"
android:versionName="1.0" >
<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.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<uses-library android:name="com.google.android.maps"/>"
<activity
android:name="com.example.margallahillhikedroid.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>
// following is main java source
// package com.example.margallahillhikedroid;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import android.os.Bundle;
import android.view.Menu;
public class MainActivity extends MapActivity {
MapView map;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
map=(MapView)findViewById(R.id.mymap);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
#Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
following is main.xml
<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.google.android.maps.MapView
android:id="#+id/mymap"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:apiKey="AIzaSyBcTxeirTSzthVlMal5JDDC-SK-Mw7s_CE"/>
</RelativeLayout>
on running the app following errors in console section displayed;
[2014-04-14 07:37:14 - MargallahillHikedroid] Dx
trouble writing output: already prepared
[2014-04-14 07:37:14 - Dex Loader] Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
[2014-04-14 07:37:14 - MargallahillHikedroid] Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
in the problem section following error is displayed
Description Resource Path Location Type
Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace. MargallahillHikedroid Unknown Android Packaging Problem
I am making a map application but on running it above mentioned errors are displayed in the problem section as well as the console section.
Your problem is that you are trying to implement Google Maps API V1, probably using the Google Maps API V2 key. And That you can't do.
So what you should do is make the following changes in your code:
1. Remove: <uses-library android:name="com.google.android.maps"/>"
from your manifest file, this a V1 permission.
2. If you want to support V8 API then you have to remove the implementation of you activity to MapActivity and change it to FragmentActivity. For supporting fragment on older systems.
3. Change you xml layout file from:
<com.google.android.maps.MapView
android:id="#+id/mymap"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:apiKey="AIzaSyBcTxeirTSzthVlMal5JDDC-SK-Mw7s_CE"/>
To this:
<fragment
android:name="com.google.android.gms.maps.SupportMapFragment"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent" />
4. Finally you have to add some staff in your manifest file:
Add those permissions:
<permission android:name="your.application.package.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="your.application.package.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET" />
<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" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
change your.application.package to your actual application package name.
And add those:
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="Your Google Maps API V2 Key" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
under the application hive.
You can also use this guide that I wrote on this topic to help you out:
Google Maps API V2
and go over the steps of producing the api key and make sure you haven't missed any thing:
Google Maps API V2 Key
It sometimes appen with Eclipse. You just have to close Eclipse, relaunch it, clean your project, refresh it, and retry... It should do the trick... ;)
The min sdk forvmap v2 is 11 please change to that.And try
You need to implement Google Map V2. May be following line causing the problem in the manifest uses-library android:name="com.google.android.maps"
First things first.
I've been having a lot of trouble getting a map to be displayed. By this I mean that I've followed multiple tutorials, including the Google Maps V2 intro here.
I read somewhere that I cannot test maps on emulators (elsewhere that I need another kind of custom emulator) so my process has been continually to use dropbox to install the app on my own phone. This may be relevant because i've just read here that the only way a map will work is if it's signed and installed through Google Play Store.
More to the problem, what I see when I view the app is and empty map with zoom controls. I've read in several places that this seems to be signing trouble. I've reread the whole process and after trying almost every possibility, I know I must know exactly what i'm doing first.
As I understand it there are two ways to get an app to work: debug or testing and release. I've signed the app with both keystores, having added them to the Google API Console as described in the tutorials. Both attempts bring about the same result: the empty map with zoom controls.
I will say this: there is a fair amount of, if not contradicting, ambiguous information about this whole process.
UPDATE
It's working now and I have now idea why. I will share my relevant files just in case it can help anyone else. These files are exact copy paste (minus relevant package names) from here.
MainActivity.java
package com.taveras.androidmapsv2;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;
public class MainActivity extends Activity {
// Google Map
private GoogleMap googleMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try {
// Loading map
initilizeMap();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* function to load map. If map is not created it will create it for you
* */
private void initilizeMap() {
if (googleMap == null) {
googleMap = ((MapFragment) getFragmentManager().findFragmentById(
R.id.map)).getMap();
// check if map is created successfully or not
if (googleMap == null) {
Toast.makeText(getApplicationContext(),
"Sorry! unable to create maps", Toast.LENGTH_SHORT)
.show();
}
}
}
#Override
protected void onResume() {
super.onResume();
initilizeMap();
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
AndroidManifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.taveras.androidmapsv2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="18" />
<permission
android:name="com.taveras.androidmapsv2.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.taveras.androidmapsv2.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.taveras.androidmapsv2.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.gms.version"
android:value="#integer/google_play_services_version"
/>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDLKtTtTDxULNBvNLtGPvkEf6NNacs-42A" />
</application>
</manifest>
Thanks in advance for any leads.
Ebichuhamster
sorry can't comment yet due to low rep, this link helped me a lot when i first started working with Google Maps V2. it has everything you need to get started as well as getting the api key.
usually a blank map is a problem with the signing process as you have read. try following the link it's very detailed.
also as far as i know you can run google maps on the emulator there are a lot of threads regarding this matter here on SO. (this thread for example)
I am trying to load mapview on my emulator and device
I have been trying this for two days but some time I just get grid line without any map, and sometimes a FATAL error and my app doesn't start both on my emulator and device.
I tried everything, every code that is present on internet but nothing works.
You are my last hope.
I followed steps stated on site
I got my API key from here
I have done everything that I could. Please tell me if this process is not right then what should I do. I am doing it for Gingerbread 2.3.3 (API 10)..
Waiting for the answer thanku.
My Log Cat:
07-06 02:12:45.692: E/AndroidRuntime(3020): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.maps/com.example.maps.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
My AndroidMenifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.maps"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET"/>
<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"/>
<!-- The following two permissions are not required to use
Google Maps Android API v2, but are recommended. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="10" />
<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="AEdPqrEAAAAI5QAuDgiTRjyU-y_MK-ZRQqBaN_VoLb4gADuCwA"/>
</application>
My Main.xml
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
xmlns:tools="http://schemas.android.com/tools" />
My MainActivity.Java
package com.example.maps;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import android.os.Bundle;
public class MainActivity extends MapActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MapView view = (MapView) findViewById(R.id.map);
view.setBuiltInZoomControls(true);
}
#Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
Well, you are using a fragment but load it in a MapView. This is why you get the RuntimeException, because it is not possible to inflate a fragment into a MapView object. MapView is an old class that was supported in android maps API version 1, which is deprecated now.
From the dev site you quoted:
Note: The Google Maps Android API v2 uses a new system of managing keys. Existing keys from a Google Maps Android v1 application, commonly known as MapView, will not work with the v2 API.
Your activity should actually extend MapFragment and you should use the FragmentManager or SupportFragmentManager to inflate your map.
public class MyActivity extends FragmentActivity {
private GoogleMap mMapView;
private SupportMapFragment mFragment;
#Override
protected void onCreate() {
super.onCreate();
FragmentManager fragmentManager = getSupportFragmentManager();
mFragment = ((SupportMapFragment) fragmentManager.findFragmentById(R.id.map));
mMapView = mFragment.getMap();
mMapView.getUiSettings().setZoomControlsEnabled(true);
// configure other settings of map view
}
}
Also the name of the class in the layout xml should also be SupportMapFragment like so:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
xmlns:tools="http://schemas.android.com/tools" />
you can find more info here: https://developers.google.com/maps/documentation/android/intro
In main.xml
Shouldn't
android:name="com.google.android.gms.maps.MapFragment"
be
class="com.google.android.gms.maps.MapFragment"
I'm doing a beginner android primer book and the code seems simple enough. However, it cannot run. When I try to run it, eclipse crashes.
Here's my java code:
package com.example.gamebeginner;
import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.widget.Button;
public class MainActivity extends Activity implements View.OnClickListener {
Button button;
int touchCount;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
button = new Button(this);
button.setText("Touch me!");
button.setOnClickListener(this);
setContentView(button);
}
public void onClick(View v){
touchCount++;
button.setText("Touched me " + touchCount + " times(s)");
}
}
activity.main xml
<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"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="#string/hello_world" />
</RelativeLayout>
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.gamebeginner"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="14" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:debuggable="true" >
<activity
android:name="com.example.gamebeginner.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>
I'm on jdk version 1.6. any help would be much appreciated.
Make sure you device is connected and working correctly.
Go to window -> show view -> android -> devices click ok so that you
open the device list. Make sure you see your device listed in the
window.
Make sure that you click on the device so the device is highlighted.
Now go and click on your logcat tab. If you do not have the logcat
tab opened, go to window -> show view -> other -> android -> logcat.
Make sure you DO NOT select the deprecated version.
Also try killing and restarting the adb daemon.
adb kill-server and then adb start-server at a command prompt. If you do not have adb on your path, you will need to reference the full path to adb or do the command within the directory that contains adb.
Disconnecting and reconnecting the device solved the issue.
If your error message (in logcat, right?) is java se binary is not responding, I would venture to say that you are generating the code in the wrong way somehow. Are you using Eclipse or IntelliJ to build your app? What is the project type you are using - Java application, or Android application?
First add setContentView and afer View