Select to view content in your preferred language

Problems with the Hello World Map sample

966
5
04-12-2012 05:14 AM
DanielMoraru
New Contributor
Hi,
I�??m new to ArcGIS for Android and have problems with the arcgis samples. When I try to launch the �??Hello World�?� Maps example on my android phone it always crashes.
I modified the MapView initExtent as shown in the help section here and tried it again without effect. All permissions and variables are set in the manifest.

Another example Viewshed is working out of the box on my phone.

Thanks,
Daniel


04-12 11:58:41.540: D/AndroidRuntime(4100): Shutting down VM
04-12 11:58:41.540: W/dalvikvm(4100): threadid=1: thread exiting with uncaught exception (group=0x4001e578)
04-12 11:58:41.545: E/AndroidRuntime(4100): FATAL EXCEPTION: main
04-12 11:58:41.545: E/AndroidRuntime(4100): java.lang.VerifyError: com.esri.core.internal.b.a.b
04-12 11:58:41.545: E/AndroidRuntime(4100):  at com.esri.android.map.ags.ArcGISTiledMapServiceLayer.<init>(Unknown Source)
04-12 11:58:41.545: E/AndroidRuntime(4100):  at com.esri.android.map.ags.ArcGISTiledMapServiceLayer.<init>(Unknown Source)
04-12 11:58:41.545: E/AndroidRuntime(4100):  at com.esri.arcgis.android.samples.helloworld.HelloWorld.onCreate(HelloWorld.java:34)
04-12 11:58:41.545: E/AndroidRuntime(4100):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-12 11:58:41.545: E/AndroidRuntime(4100):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
04-12 11:58:41.545: E/AndroidRuntime(4100):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
04-12 11:58:41.545: E/AndroidRuntime(4100):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-12 11:58:41.545: E/AndroidRuntime(4100):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
04-12 11:58:41.545: E/AndroidRuntime(4100):  at android.os.Handler.dispatchMessage(Handler.java:99)
04-12 11:58:41.545: E/AndroidRuntime(4100):  at android.os.Looper.loop(Looper.java:130)
04-12 11:58:41.545: E/AndroidRuntime(4100):  at android.app.ActivityThread.main(ActivityThread.java:3691)
04-12 11:58:41.545: E/AndroidRuntime(4100):  at java.lang.reflect.Method.invokeNative(Native Method)
04-12 11:58:41.545: E/AndroidRuntime(4100):  at java.lang.reflect.Method.invoke(Method.java:507)
04-12 11:58:41.545: E/AndroidRuntime(4100):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
04-12 11:58:41.545: E/AndroidRuntime(4100):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
04-12 11:58:41.545: E/AndroidRuntime(4100):  at dalvik.system.NativeStart.main(Native Method)


Layout
<?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"
    >
    
<!-- MapView layout and initial extent -->
<com.esri.android.map.MapView
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
initExtent = "-1.3296373526814876E7 3930962.41823043 -1.2807176545789773E7 4201243.7502468005">
</com.esri.android.map.MapView>
   
</LinearLayout>


Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.esri.arcgis.android.samples.helloworld"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".HelloWorld"
                  android:label="@string/app_name"
                  android:configChanges="orientation">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>


<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-sdk android:minSdkVersion="8" />
<uses-feature android:glEsVersion="0x00020000"
        android:required="true" />
</manifest> 


Java Class
package com.esri.arcgis.android.samples.helloworld;

import android.app.Activity;
import android.os.Bundle;

import com.esri.android.map.MapView;
import com.esri.android.map.ags.ArcGISDynamicMapServiceLayer;
import com.esri.android.map.ags.ArcGISTiledMapServiceLayer;

public class HelloWorld extends Activity {
 MapView map = null;

 /** Called when the activity is first created. */
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);

  // Retrieve the map and initial extent from XML layout
  map = (MapView)findViewById(R.id.map);
  // Add dynamic layer to MapView
  map.addLayer(new ArcGISTiledMapServiceLayer("" +
  "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"));

 }

 protected void onPause() {
  super.onPause();
  map.pause();
 }

 protected void onResume() {
  super.onResume();
  map.unpause();
 }
 
}
0 Kudos
5 Replies
SimonKlein
Regular Contributor
It works for me on my phone and on my tablet but it does not change the viewshed.
I used exactly your code. Did you try to clean the project?
0 Kudos
JohnAllen
Deactivated User
Make sure you uninstall any previous ESRI HelloWorld android projects that are on the device if any.

I deployed the HelloWorld app from two different computers (office/home) with a different name (Helloworld, helloworldtest) and the app would crash.

So I uninstalled all ESRI hellowold apps from phone and computers and started over and now everything works.
0 Kudos
AlessandroRuzzon
Emerging Contributor
Hi,

I've the same problem but nothing works! I'm trying to install it on the Galaxy Tab 10.1 with Android 3.2.
I've tried with the 2.2, the 2.3 but the error is the same.

How could I do?

thanks
0 Kudos
SimonKlein
Regular Contributor
What happens when you try to start the sample?

If you haven't tried uninstall and reinstall the SDK please do that.
If it still does not work afterwards, could you show us the logcat of the crash?
0 Kudos
AlessandroRuzzon
Emerging Contributor
I was using the 1.0.1 version. I downloaded the 1.1 and now it works!

Thanks a lot!
0 Kudos