Note that there are some explanatory texts on larger screens.

plurals
  1. POAny new class I create in my project, I get NoClassDefFound
    primarykey
    data
    text
    <p>I have a strange problem. I have a single class in a project and when I run it,it starts ok. I put this class in my project( where I have some packages and some classes) ,I put it in AndroidManifest, but when I run I get NoClassDefFound. I realised that any new class I do in my project,I get this error. Can anyone help me? I don't know any solution for this error..Help,pls..</p> <p>This is my class :</p> <pre><code>package com.ShoppingList; import android.graphics.drawable.Drawable; import android.graphics.Canvas; import android.os.Bundle; import android.view.KeyEvent; import android.widget.Toast; import com.google.android.maps.GeoPoint; import com.google.android.maps.ItemizedOverlay; import com.google.android.maps.MapActivity; import com.google.android.maps.MapView; import com.google.android.maps.MyLocationOverlay; import com.google.android.maps.OverlayItem; import java.util.ArrayList; import java.util.List; public class ShopsOnMap extends MapActivity { private MapView map=null; private MyLocationOverlay me=null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); map=(MapView)findViewById(R.id.map); map.getController().setCenter(getPoint (40.76793169992044,-173.98180484771729)); map.getController().setZoom(17); map.setBuiltInZoomControls(true); Drawable marker=getResources().getDrawable(R.drawable.pushpin); marker.setBounds(0, 0, marker.getIntrinsicWidth(), marker.getIntrinsicHeight()); map.getOverlays().add(new SitesOverlay(marker)); me=new MyLocationOverlay(this, map); map.getOverlays().add(me); } @Override public void onResume() { super.onResume(); me.enableCompass(); } @Override public void onPause() { super.onPause(); me.disableCompass(); } @Override protected boolean isRouteDisplayed() { return(false); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_S) { map.setSatellite(!map.isSatellite()); return(true); } else if (keyCode == KeyEvent.KEYCODE_Z) { map.displayZoomControls(true); return(true); } return(super.onKeyDown(keyCode, event)); } private GeoPoint getPoint(double lat, double lon) { return(new GeoPoint((int)(lat*1000000.0), (int)(lon*1000000.0))); } private class SitesOverlay extends ItemizedOverlay&lt;OverlayItem&gt; { private List&lt;OverlayItem&gt; items=new ArrayList&lt;OverlayItem&gt;(); private Drawable marker=null; public SitesOverlay(Drawable marker) { super(marker); this.marker=marker; items.add(new OverlayItem(getPoint (40.748963847316034,-173.96807193756104), "UN", "United Nations")); items.add(new OverlayItem(getPoint (40.76866299974387,-173.98268461227417), "Lincoln Center", "Home of Jazz at Lincoln Center")); items.add(new OverlayItem(getPoint (40.765136435316755,-173.97989511489868), "Carnegie Hall", "Where you go with practice, practice, practice")); items.add(new OverlayItem(getPoint (40.70686417491799,-174.01572942733765), "The Downtown Club", "Original home of the Heisman Trophy")); populate(); } @Override protected OverlayItem createItem(int i) { return(items.get(i)); } @Override public void draw(Canvas canvas, MapView mapView, boolean shadow) { super.draw(canvas, mapView, shadow); boundCenterBottom(marker); } @Override protected boolean onTap(int i) { Toast.makeText(ShopsOnMap.this, items.get(i).getSnippet(), Toast.LENGTH_SHORT).show(); return(true); } @Override public int size() { return(items.size()); } } } </code></pre> <p>And in Logcat I have :</p> <pre><code>05-14 13:10:24.755: ERROR/AndroidRuntime(368): java.lang.NoClassDefFoundError: com.ShoppingList.ShopsOnMap 05-14 13:10:24.755: ERROR/AndroidRuntime(368): at com.ShoppingList.Lists.onCreate(Lists.java:122) 05-14 13:10:24.755: ERROR/AndroidRuntime(368): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 05-14 13:10:24.755: ERROR/AndroidRuntime(368): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459) 05-14 13:10:24.755: ERROR/AndroidRuntime(368): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 05-14 13:10:24.755: ERROR/AndroidRuntime(368): at android.app.ActivityThread.access$2200(ActivityThread.java:119) 05-14 13:10:24.755: ERROR/AndroidRuntime(368): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863) 05-14 13:10:24.755: ERROR/AndroidRuntime(368): at android.os.Handler.dispatchMessage(Handler.java:99) 05-14 13:10:24.755: ERROR/AndroidRuntime(368): at android.os.Looper.loop(Looper.java:123) 05-14 13:10:24.755: ERROR/AndroidRuntime(368): at android.app.ActivityThread.main(ActivityThread.java:4363) 05-14 13:10:24.755: ERROR/AndroidRuntime(368): at java.lang.reflect.Method.invokeNative(Native Method) 05-14 13:10:24.755: ERROR/AndroidRuntime(368): at java.lang.reflect.Method.invoke(Method.java:521) 05-14 13:10:24.755: ERROR/AndroidRuntime(368): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 05-14 13:10:24.755: ERROR/AndroidRuntime(368): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 05-14 13:10:24.755: ERROR/AndroidRuntime(368): at dalvik.system.NativeStart.main(Native Method) 05-14 13:10:24.783: INFO/Process(52): Sending signal. PID: 368 SIG: 3 05-14 13:10:24.796: INFO/dalvikvm(368): threadid=7: reacting to signal 3 05-14 13:10:24.854: INFO/dalvikvm(368): Wrote stack trace to '/data/anr/traces.txt' 05-14 13:10:26.295: INFO/Process(368): Sending signal. PID: 368 SIG: 9 05-14 13:10:26.393: INFO/ActivityManager(52): Process com.ShoppingList (pid 368) has died. 05-14 13:10:26.444: INFO/WindowManager(52): WIN DEATH: Window{44e46860 com.ShoppingList/com.ShoppingList.Start paused=false} 05-14 13:10:26.444: INFO/WindowManager(52): WIN DEATH: Window{44e41618 AtchDlg:com.ShoppingList/com.ShoppingList.Start paused=false} 05-14 13:10:26.603: INFO/ActivityManager(52): Start proc com.ShoppingList for activity com.ShoppingList/.Start: pid=485 uid=10043 gids={3003} </code></pre> <p>AndroidManifest :</p> <p> </p> <pre><code>&lt;uses-library android:name="com.google.android.maps" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt; &lt;activity android:name=".Start" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".Lists"&gt;&lt;/activity&gt; &lt;activity android:name=".NewList"&gt;&lt;/activity&gt; &lt;activity android:name=".AddProduct"&gt;&lt;/activity&gt; &lt;activity android:name=".Categoris"&gt;&lt;/activity&gt; &lt;activity android:name=".EditProduct"&gt;&lt;/activity&gt; &lt;activity android:name=".SimpleCalendar"&gt;&lt;/activity&gt; &lt;activity android:name="com.ShoppingList.ProductsPredefine.NewProduct"&gt;&lt;/activity&gt; &lt;activity android:name="com.ShoppingList.ProductsPredefine.Details"&gt;&lt;/activity&gt; &lt;activity android:name="com.ShoppingList.Shops.Shops"&gt;&lt;/activity&gt; &lt;activity android:name="com.ShoppingList.MapShow"&gt; &lt;activity android:name=".ShopsOnMap"&gt;&lt;/activity&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name="com.ShoppingList.Shops.SelectShop"&gt;&lt;/activity&gt; &lt;/application&gt; </code></pre> <p></p> <p>Lists.java :</p> <pre><code>package com.ShoppingList; import com.ShoppingList.databases.ListDbAdapter; import com.ShoppingList.databases.ShopDbAdapter; import com.google.android.maps.GeoPoint; import android.app.Activity; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.net.Uri; import android.os.Bundle; import android.view.ContextMenu; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ContextMenu.ContextMenuInfo; import android.widget.AdapterView; import android.widget.ListView; import android.widget.SimpleCursorAdapter; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; public class Lists extends Activity { private ListView lists; private SimpleCursorAdapter adapter; private Cursor cursor, c; private ListDbAdapter db; private ShopDbAdapter shop; float[] results; double latitudine; double longitudine; LocationManager lm; private static final int NOTIFICATION_ID = 1; private NotificationManager notificationManager; private static final int NEW_LIST = Menu.FIRST; private static final int DELETE_LIST = Menu.FIRST + 1; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.lists); lists = (ListView) findViewById(R.id.list); db = new ListDbAdapter(this); db.open(); shop = new ShopDbAdapter(this); shop.open(); fillData(); registerForContextMenu(lists); lists.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) { Intent j = new Intent(Lists.this, AddProduct.class); Cursor c = (Cursor) parent.getAdapter().getItem(position); j.putExtra("titlelist", c.getString(c .getColumnIndex(db.KEY_TITLE))); j.putExtra("idlist", c .getString(c.getColumnIndex(db.KEY_ROWID))); startActivityForResult(j, 0); } }); cursor = db.fetchAll(); startManagingCursor(cursor); c = shop.fetchAll(); startManagingCursor(c); cursor.moveToFirst(); do { System.out.println("#####" + db.getShop(cursor) + "$$$$$$"); c.moveToFirst(); do { if (db.getShop(cursor) == shop.getName(c)) { latitudine = shop.getLatitudine(c); longitudine = shop.getLongitudine(c); System.out.println("%%%" + latitudine + "!!!!!"); System.out.println("%%%" + longitudine + "!!!!!"); } else c.moveToNext(); } while (c.isLast()); cursor.moveToNext(); } while (cursor.isLast()); latitudine = 46.7511187; longitudine = 23.5906539; results = new float[1]; Location.distanceBetween(46.7547825, 23.5861364, latitudine, longitudine, results); System.out.println("%%%" + latitudine + "!!!!!"); System.out.println("Distanta este" + results[0] + "!!!!!!!"); if (results[0] &lt; 800) { notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); CharSequence NotificationTicket = "Notification"; CharSequence NotificationTitle = "Notification"; CharSequence NotificationContent = "Test"; long when = System.currentTimeMillis(); Notification notification = new Notification(R.drawable.icon, NotificationTicket, when); Context context = getApplicationContext(); Intent notificationIntent = new Intent(this,ShopsOnMap.class); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notification.setLatestEventInfo(context, NotificationTitle, NotificationContent, contentIntent); notificationManager.notify(NOTIFICATION_ID, notification); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP| Intent.FLAG_ACTIVITY_SINGLE_TOP); } } public boolean onCreateOptionsMenu(Menu menu) { menu.add(0, NEW_LIST, 0, "New List");// .setIcon(R.drawable.quit); return true; } public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case NEW_LIST: createlist(); return true; } return false; } public void createlist() { startActivityForResult(new Intent(Lists.this, NewList.class), 0); } public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { menu.add(0, DELETE_LIST, 0, "Delete List"); } public boolean onContextItemSelected(MenuItem mitem) { switch (mitem.getItemId()) { case DELETE_LIST: AdapterContextMenuInfo info = (AdapterContextMenuInfo) mitem .getMenuInfo(); db.delete(info.id); fillData(); return true; default: return super.onContextItemSelected(mitem); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); fillData(); } private void fillData() { cursor = db.fetchAll(); startManagingCursor(cursor); adapter = new SimpleCursorAdapter(this, R.layout.listview, cursor, new String[] { ListDbAdapter.KEY_TITLE }, new int[] { R.id.txt1 }); lists.setAdapter(adapter); } } </code></pre> <p><strong>UPDATE</strong>: Here was my problem : </p> <pre><code>&lt;uses-library android:name="com.google.android.maps" /&gt; </code></pre> <p>must be within <code>&lt;application&gt; &lt;/application&gt;</code> </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload