-1

これにより、nexus デバイスでアプリを起動できなくなります。コードにカーソルがないため、このエラーが発生する理由がわかりません。グーグルマップを使ったアプリを作っています。それが問題の一部であるかどうかはわかりません。エラー メッセージは表示されず、正しいライブラリがすべてインポートされました。

これが私のコードです:

package com.example.gpstracking;


import java.util.List;
import java.util.Locale;
import android.app.Activity;
import android.content.Context;
import android.location.Address;
import android.location.Criteria;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.Menu;
import android.widget.TextView;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

public class MainActivity extends MapActivity  {

private long lastUpdate; 
private long lastUpdate2;
float epsilon = 0.0001f;
private TextView aTextView;
private TextView mTextView;


Location mLocation;
LocationListener mLocationListener;
LocationManager mLocationManager;
TextView tv;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    MapView mapView = (MapView) findViewById(R.id.map1);
    tv = (TextView) findViewById(R.id.tv1);

    lastUpdate = System.currentTimeMillis();


    mLocationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);

    Criteria criteria = new Criteria();;
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    criteria.setPowerRequirement(Criteria.POWER_LOW);
    String locationprovider = mLocationManager.getBestProvider(criteria,true);
    mLocation = mLocationManager.getLastKnownLocation(locationprovider);




     mLocationListener = new LocationListener() {
            public void onLocationChanged(Location location) {
                if(location != null)
                {

                    tv.setText("Latitude:" + " " + Double.toString(location.getLatitude()) + " " + "degrees" + "<br>"); 
                    tv.setText("Longitude:" + " " + Double.toString(location.getLongitude()) + " " + "degrees"); 

                }



         }


               @Override
               public void onStatusChanged(String provider, int status,
                       Bundle extras) {
               }

               public void onProviderEnabled(String provider) {
               }

               public void onProviderDisabled(String provider) {
               }

          };
        mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 3000, 1, mLocationListener);
}

@Override
public void onPause(){

    super.onPause();
    mLocationManager.removeUpdates(mLocationListener);
} 

@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;
}
}

そして彼女は丸太の猫です:

10-06 08:49:27.642: D/dalvikvm(2264): GC_FOR_ALLOC freed 247K, 4% free 7742K/8052K,   paused 32ms, total 33ms
10-06 08:49:27.652: W/CursorWrapperInner(2264): Cursor finalized without prior close()
10-06 08:49:27.682: W/dalvikvm(2264): VFY: unable to resolve static field 1355   (MapAttrs) in Lcom/google/android/gms/R$styleable;
10-06 08:49:27.682: D/dalvikvm(2264): VFY: replacing opcode 0x62 at 0x000e
10-06 08:49:27.682: D/AndroidRuntime(2264): Shutting down VM
10-06 08:49:27.682: W/dalvikvm(2264): threadid=1: thread exiting with uncaught exception     (group=0x41a5e700)
10-06 08:49:27.692: E/AndroidRuntime(2264): FATAL EXCEPTION: main
10-06 08:49:27.692: E/AndroidRuntime(2264): java.lang.NoClassDefFoundError:   com.google.android.gms.R$styleable
4

1 に答える 1

2

問題は CursorWrapperInner とは関係ありませんが、java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable.

問題は Google サービス SDK にあります。FragmentAvtivity を使用している場合は、正しくインポートし (jar だけでなくプロジェクトも)、マニフェストに登録し、SupportFragmentManager を使用していることを確認してください。

これを読んでください: GoogleマップAPI v2

于 2013-10-06T16:24:15.753 に答える