maps api and 1.5

by wayne mcfadden- Red Droid » Sat, 18 Apr 2009 22:15:10 GMT


Sponsored Links
 orry guys, originally i posted to discussion which is the wrong
place.....



I'm migrating over an application from 1.1 to 1.5 and it uses the
Google maps. I got through most of the class path issues resolved I
think but when launching the application I get the following message.

04-18 13:19:11.598: WARN/dalvikvm(816): Class resolved by unexpected
DEX: Lnet/company/android/OrgMapActivity;(0x43732af0):0x192310 ref
[Lcom/google/android/maps/MapActivity;] Lcom/google/android/maps/
MapActivity;(0x43732af0):0x188228
04-18 13:19:11.598: WARN/dalvikvm(816): Unable to resolve superclass
of Lnet/company/android/OrgMapActivity; (106)
04-18 13:19:11.608: WARN/dalvikvm(816): Link of class 'Lnet/company/
android/OrgMapActivity;' failed

So it looks like the error is Unable to resolve superclass which I
think is caused by not having
<uses-library android:name="com.google.android.maps" />
in the androidmanifest.

In my case, this line is in there. Is there a new uses-library for
1.5? Docs say that it's ok. Or specific classpath settings since the
maps.jar has been moved out? I'm not getting compilation errors, just
runtime.

I tried moving the maps.jar into the assets directory and that did not
work either.

Some other trace is below.
Thanks in advance!
Wayne McFadden

04-18 13:43:59.710: WARN/dalvikvm(776): threadid=3: thread exiting
with uncaught exception (group=0x4000fe70)
04-18 13:43:59.710: ERROR/AndroidRuntime(776): Uncaught handler:
thread main exiting due to uncaught exception
04-18 13:43:59.979: ERROR/AndroidRuntime(776):
java.lang.ExceptionInInitializerError
04-18 13:43:59.979: ERROR/AndroidRuntime(776): at
java.lang.Class.newInstanceImpl(Native Method)
04-18 13:43:59.979: ERROR/AndroidRuntime(776): at
java.lang.Class.newInstance(Class.java:1472)
04-18 13:43:59.979: ERROR/AndroidRuntime(776): at
android.app.Instrumentation.newActivity(Instrumentation.java:1097)
04-18 13:43:59.979: ERROR/AndroidRuntime(776): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2186)
04-18 13:43:59.979: ERROR/AndroidRuntime(776): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2284)
04-18 13:43:59.979: ERROR/AndroidRuntime(776): at
android.app.ActivityThread.access$1800(ActivityThread.java:112)
04-18 13:43:59.979: ERROR/AndroidRuntime(776): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
04-18 13:43:59.979: ERROR/AndroidRuntime(776): at
android.os.Handler.dispatchMessage(Handler.java:99)
04-18 13:43:59.979: ERROR/AndroidRuntime(776): at
android.os.Looper.loop(Looper.java:123)
04-18 13:43:59.979: ERROR/AndroidRuntime(776): at
android.app.ActivityThread.main(ActivityThread.java:3948)
04-18 13:43:59.979: ERROR/AndroidRuntime(776): at
java.lang.reflect.Method.invokeNative(Native Method)
04-18 13:43:59.979: ERROR/AndroidRuntime(776): at
java.lang.reflect.Method.invoke(Method.java:521)
04-18 13:43:59.979: ERROR/AndroidRuntime(776): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:782)
04-18 13:43:59.979: ERROR/AndroidRuntime(776): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
04-18 13:43:59.979: ERROR/AndroidRuntime(776): at
dalvik.system.NativeStart.main(Native Method)
04-18 13:43:59.979: ERROR/AndroidRuntime(776): Caused by:
java.lang.NoClassDefFoundError: net.company.android.OrgMapActivity
04-18



maps api and 1.5

by Brian Conrad » Sun, 19 Apr 2009 02:53:21 GMT


 id you set the project up for level see or Google Apps which include 
the Maps library and 1.5? Just 1.5 won't do for MapActivity as I found
out when I recompiled my program but setting it to Google Apps (the
third setting) fixed it.

wayne mcfadden- Red Droid wrote:


--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


maps api and 1.5

by Xavier Ducrohet » Sun, 19 Apr 2009 03:23:59 GMT


 s long as you set the build target to be "Google APis" and set the
uses-library you should be good.

Is the class net.company.android.OrgMapActivity in a different project
referenced by your app project?

Xav

On Sat, Apr 18, 2009 at 7:15 AM, wayne mcfadden- Red Droid
<waynemcfad...@gmail.com> wrote:



--
Xavier Ducrohet
Android Engineer, Google.

--~--~---------~--~----~------------~-------~--~----~



maps api and 1.5

by wayne mcfadden- Red Droid » Sun, 19 Apr 2009 23:22:42 GMT


 Hi Guys,
The problem I think was that while trying to get this running and
trying different configs, I imported the maps.jar via the class path.
All you need to do is set the build target to be the Google APIs like
the responses above say.   Once I removed the jar from the class path,
the app came up fine.

Thanks again for the responses. I really appreciate it!
Wayne

--~--~---------~--~----~------------~-------~--~----~



maps api and 1.5

by Andr茅 Charles Legendre » Tue, 21 Apr 2009 19:37:35 GMT


 Hi

I get the same problem, and changed the build target to be the Google
API, then I create an AVD for Google Api
and finaly I get :

Unable to resolve superclass of Lorg/example/android/apis/MapViewDemo;

where org.example.android.apis is the package and MapViewDemo is a
copy of MapViewDemo.java provided in samples.

My manifest is :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=" http://schemas.android.com/apk/res/android" ;
      package="org.example.android.apis"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:label="@string/app_name"
            android:icon="@drawable/icon">
                <uses-library android:name="com.google.android.maps" />
         <activity android:name=".MapViewDemo" 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-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" 
/>
</manifest>

Any help welcome.

Andre

--~--~---------~--~----~------------~-------~--~----~



maps api and 1.5

by Andr茅 Charles Legendre » Wed, 22 Apr 2009 01:29:18 GMT


 Hi

Finally, my error was to left maps.jar in the classpath

Now, this very simple Map app with 1.5 SDK launch good

Thank for all the responses. It helps a lot.

Andre

--~--~---------~--~----~------------~-------~--~----~



maps api and 1.5

by brian.schimmel » Mon, 25 May 2009 20:48:43 GMT


 i everybody,

I'm getting the same problems. Of course I have read this thread and
tried everything that was suggested (and some more), but it does not
work. Here are the facts:
* Using SDK 1.5_r1
* Project target in Eclipse is "Google APIs 1.5"
* AndroidManifest.xml contains <uses-sdk android:minSdkVersion="3" />
inside the manifest element
* AndroidManifest.xml contains <uses-library
android:name="com.google.android.maps" /> inside the application
element
* maps.jar is NOT added manually to the buildpath, but is shown under
Project -> Google APIs -> maps.jar
* The maps key is setup properly (that is, worked before switching to
1.5)
* code works when compiled againt the 1.1 API, but I need to compile
for 1.5 because I want to provide a Widget.

On the emulator (Firmware 1.5, google_sdk_eng 1.5 CUPCAKE 147336 test-
keys, the one that comes with DSK 1.5_r1) I get this:

05-25 12:33:40.554: INFO/ActivityManager(568): Starting activity:
Intent { comp={com.webxells.ourapp/.OurMapview} }
05-25 12:33:40.564: DEBUG/AndroidRuntime(819): Shutting down VM
05-25 12:33:40.564: WARN/dalvikvm(819): threadid=3: thread exiting
with uncaught exception (group=0x4000fe70)
05-25 12:33:40.564: ERROR/AndroidRuntime(819): Uncaught handler:
thread main exiting due to uncaught exception
05-25 12:33:40.584: ERROR/AndroidRuntime(819):
android.content.ActivityNotFoundException: Unable to find explicit
activity class {com.webxells.ourapp/.OurMapview}; have you declared
this activity in your AndroidManifest.xml?
05-25 12:33:40.584: ERROR/AndroidRuntime(819): at
android.app.Instrumentation.checkStartActivityResult
(Instrumentation.java:1480)
05-25 12:33:40.584: ERROR/AndroidRuntime(819): at
android.app.Instrumentation.execStartActivity(Instrumentation.java:
1454)
05-25 12:33:40.584: ERROR/AndroidRuntime(819): at
android.app.Activity.startActivityForResult(Activity.java:2656)
05-25 12:33:40.584: ERROR/AndroidRuntime(819): at
android.app.Activity.startActivity(Activity.java:2700)
05-25 12:33:40.584: ERROR/AndroidRuntime(819): at
com.webxells.ourapp.CommonUi.onOptionsItemSelected(CommonUi.java:64)
05-25 12:33:40.584: ERROR/AndroidRuntime(819): at
com.webxells.ourapp.OurAppStart.onOptionsItemSelected(OurAppStart.java:
22)
05-25 12:33:40.584: ERROR/AndroidRuntime(819): at
android.app.Activity.onMenuItemSelected(Activity.java:2085)
... some more...

Of course, the activity is declared in the AndroidManifest.xml, and
this declaration worked when compiling against the 1.1 API.

And on a real device (HTC Dev Phone 1, Firmware 1.5, dream_devphone-
userdebug 1.5 CRB21 147201 test-keys) I get another error, instead of
the one above:

05-25 12:17:34.764: WARN/dalvikvm(691): Unable to resolve superclass
of Lcom/webxells/ourapp/OurMapview; (100)
05-25 12:17:34.764: WARN/dalvikvm(691): Link of class 'Lcom/webxells/
ourapp/OurMapview;' failed
05-25 12:17:34.764: ERROR/dalvikvm(691): Could not find class
'com.webxells.ourapp.OurMapview', referenced from method
com.webxells.ourapp.CommonUi.onOptionsItemSelected
05-25 12:17:34.764: WARN/dalvikvm(691): VFY: unable to resolve const-
class 114 (Lcom/webxells/ourapp/OurMapview;) in Lcom/webxells/ourapp/
CommonUi;
05-25 12:17:34.764: WARN/dalvikvm(691): VFY: rejecting opcode 0x1c at
0x0045
05-25 12:17:34.764: WARN/dalvikvm(691): VFY: rejected Lcom/webxells/
ourapp/CommonUi;.onOptionsItem



maps api and 1.5

by Georgy » Tue, 07 Jul 2009 09:15:39 GMT


 ello Brian,

I am having your same issue. Were you able to solve it?

thanks

On May 25, 8:48am, "brian.schimmel" <brian.schim...@googlemail.com>
wrote:
--~--~---------~--~----~------------~-------~--~----~



maps api and 1.5

by Spiral » Wed, 22 Jul 2009 01:22:57 GMT


 ame here.

On Jul 6, 8:45pm, Georgy <georgearna...@gmail.com> wrote:

--~--~---------~--~----~------------~-------~--~----~



maps api and 1.5

by jagtap.jj » Thu, 30 Jul 2009 14:51:03 GMT


 efer this
http://www.anddev.org/viewtopic.php?p=24902#24902

On Jul 21, 10:12pm, Spiral <jmri...@gmail.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



maps api and 1.5

by brian.schimmel » Thu, 30 Jul 2009 17:31:06 GMT


 ell, in the end I couldn't get Google Maps to run on 1.5 no matter
how hard I tried. Now I'm happily using OpenStreetMap, which was up
and running in 15 minutes, but needed one or two days of tweeking
until it met my needs. See
http://www.anddev.org/openstreetmap_mapview_for_android-t2967.html

Anyway, that's nothing compared to the many days I spend trying to get
Google Maps working along with a Widget. The thread
http://groups.google.com/group/android-developers/browse_thread/thread/7ce1902505bba25a/f915dcb6d1ee6f19?lnk=gst&q=maps+widget#f915dcb6d1ee6f19
states that this is currently impossible anyway.

Anyway, some of you might acutally need to use Google Maps, and I hope
that there will be some clarification for everyone who still
experiences difficulties and a bugfix in the next SDK version.

On 30 Jul., 08:50, "jagtap.jj" <jagtap...@gmail.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Multiple overlay items

I seem to be having a problem with using ItemizedOverlay and
OveralyItems in it.

I can get the first overlayItem to appear on the map but not any items
after that.

Example of the code:


Java:

protected void myCalledFunction(Location myLoc) {
          // TODO Auto-generated method stub
          Markers usersMarker = new Markers(user,overview.this);
          int lat,lon;
          HttpEntity ser_resp;
          String text;

          /* Add my location to the list */
          if (myLoc != null) {


            GeoPoint myPoint = new GeoPoint(
                    (int) (myLoc.getLatitude() * 1E6),
                    (int) (myLoc.getLongitude() * 1E6));
            mc.animateTo(myPoint);
            OverlayItem itemMyself = new
OverlayItem(myPoint,getString(R.string.myPosition),getString(R.string.myPosition));
            itemMyself.setMarker(this.icon);

            usersMarker.addOverlay(itemMyself);
          }

          if (this.userid != -1) {
               Map<String, String> data = new HashMap<String,
String>();
               data.put("userid", this.userid.toString());

               try {
                    HttpResponse re = Registration.doPost("http://
www.android-town.com/getCloseUsers.php",data);

                    ser_resp = re.getEntity();
                    InputStream is = ser_resp.getContent();
                 BufferedInputStream bis = new
BufferedInputStream(is);
                 ByteArrayBuffer baf = new ByteArrayBuffer(20);

                 int current = 0;
                 while((current = bis.read()) != -1){
                     baf.append((byte)current);
                 }

                    /* Convert the Bytes read to a String. */
                 text = new String(baf.toByteArray());

                 /* If the web service returns nearby users... */
                 if (text != "") {

                    if (text.indexOf("##")>0) {
                         String[] users = text.split("##");
                         for (String user : users) {
                              String[] userData = user.split(";");
                              lat = Integer.valueOf(userData[1]);
                              lon = Integer.valueOf(userData[2]);

                              Log.e("overview", "username:
"+userData[0]+", lat: "+userData[1]+", lon: "+userData[2]);

                              GeoPoint p = new GeoPoint(
                                  (int) (lat * 1E6),
                                  (int) (lon * 1E6));
                              OverlayItem item = new
OverlayItem(p,userData[0],userData[3]);
                              item.setMarker(this.user);


                              usersMarker.addOverlay(item);

                         }
                    } else {
                         String[] userData = text.split(";");
                         lat = Integer.valueOf(userData[1]);
                         lon = Integer.valueOf(userData[2]);

                         Log.e("overview", "username: "+userData[0]+",
lat: "+userData[1]+", lon: "+userData[2]);

                         GeoPoint p = new GeoPoint(
                             (int) (lat * 1E6),
                             (int) (lon * 1E6));

                         OverlayItem item = new
OverlayItem(p,userData[0],userData[3]);
                         item.setMarker(this.user);
                         usersMarker.addOverlay(item);
                    }

                 }

               } catch (ClientProtocolException e) {
                e.printStackTrace();
                Toast.makeText(getApplicationContext(),
getString(R.string.noURLAccess), Toast.LENGTH_SHORT).show();
               } catch (IOException e) {
                e.printStackTrace();
                Toast.makeText(getApplicationContext(),
getString(R.string.noURLAccess), Toast.LENGTH_SHORT).show();
               }
          }

          /* Draw markers */
        //mc.setZoom(16);
     Log.e("overlays","items: "+String.valueOf(usersMarker.size())+",
overlays: "+String.valueOf(mapOverlays.size()));

     if (mapOverlays.size() == 0) {
          mapOverlays.add(usersMarker);
        } else {
          mapOverlays.clear();
          mapOverlays.add(usersMarker);
        }
        karta.invalidate();

     }


and my implementation of the ItemizedOverlay class:


Java:

public class Markers extends ItemizedOverlay {

     private Context ctx;

     private ArrayList<OverlayItem> mOverlays = new
ArrayList<OverlayItem>();

     public Markers(Drawable defaultMarker, Context cont) {

          super(boundCenterBottom(defaultMarker));
          this.ctx = cont;
          // TODO Auto-generated constructor stub
     }

     @Override
     protected OverlayItem createItem(int i) {
          // TODO Auto-generated method stub
          return mOverlays.get(i);
     }

     @Override
     public boolean onTap(GeoPoint p, MapView mapView) {
          // TODO Auto-generated method stub
          return super.onTap(p, mapView);
     }


     @Override
     protected boolean onTap(int index) {
          // TODO Auto-generated method stub
          Toast.makeText(this.ctx,
mOverlays.get(index).getTitle().toString()+", Latitude:
"+mOverlays.get(index).getPoint().getLatitudeE6(),
Toast.LENGTH_SHORT).show();
          return super.onTap(index);
     }

     @Override
     public int size() {
          // TODO Auto-generated method stub
          return mOverlays.size();
     }

     public void addOverlay(OverlayItem item) {
          mOverlays.add(item);
          setLastFocusedIndex(-1);
          populate();

     }

     public void clear() {
          mOverlays.clear();
          setLastFocusedIndex(-1);
          populate();
     }


}


the first marker shows up on the map but if I add any more they don't
show up? Is there a problem with the populate() method? I tried
calling it manually after adding all markers but it still didn't help.
Please, if you have any idea what could be wrong, say so.

-- 

2. How to use OpenGL ES 1.x with android.view.View (without using GLSurfaceView) in Android 1.6?

<P>Hello,</P><P>&#160;I'm trying to use OpenGL ES 1.x in my application.And I 
have read the com.example.android.apis.graphics.GLSurfaceViewActivity in 
ApiDemos.I found that the GLSurfaceView is used and it extends SurfaceView. But 
there are two problems when the GLSurfaceView is used.&#160;</P><P>1.The 
SurfaceView is always in front of other views no matter how many views cover 
it.</P><P>It is said that "The surface is Z ordered so that it is behind the 
window holding its SurfaceView; the SurfaceView punches a hole in its window to 
allow its surface to be displayed. " in the reference of sdk.I think that is 
the reason.</P><P>2.I can use only one GLSurfaceView in my application, or an 
exception will be thrown.<BR></P><P>So I try to use OpenGL with 
android.view.View and I found this code at 
http://www.anddev.org/download.php?id=107</P><P>The source code imports a class 
android.graphics.OpenGLContext that I can't find it in Android 1.6. It is said 
that the android.graphics.OpenGLContext is in m3-rc37a. </P><P>So how can I use 
OpenGL ES 1.x with android.view.View in Android 1.6?&#160;</P>&#160;

-- 

3. Deleting a View from its Parent

4. Alternative Market: Is it Possible?

5. Uncaught exception thrown by finalizer (will be discarded)

6. Problem with Embedded Widgets in Preferences

7. HOWTO: Install Android SDK and AVD Manager behind a Proxy/Firewall in Windows