Android java.lang.NoClassDefFoundError:com.mapbox.mapboxsdk.MapboxAccountManager
我已经从eclipse项目下载了MapBox jar文件,并将其添加到eclipse项目中。我在运行应用程序时遇到以下异常 02-01 13:11:42.867:E/AndroidRuntime(2674): java.lang.NoClassDefFoundError: com.mapbox.mapboxsdk.MapboxAccountManager 02-01 13:11:42.867: E/AndroidRuntime(2674):在 com.example.mapbox.MainActivity.onCreate(MainActivity.java:18) 这是我的密码:Android java.lang.NoClassDefFoundError:com.mapbox.mapboxsdk.MapboxAccountManager,android,eclipse,mapbox,Android,Eclipse,Mapbox,我已经从eclipse项目下载了MapBox jar文件,并将其添加到eclipse项目中。我在运行应用程序时遇到以下异常 02-01 13:11:42.867:E/AndroidRuntime(2674): java.lang.NoClassDefFoundError: com.mapbox.mapboxsdk.MapboxAccountManager 02-01 13:11:42.867: E/AndroidRuntime(2674):在 com.example.mapbox.MainAct
public class MainActivity extends Activity {
private MapView mapView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MapboxAccountManager.start(this, getString(R.string.access_token));
setContentView(R.layout.activity_main);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap arg0) {
// TODO Auto-generated method stub
}
});
}
主要活动
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:mapbox="http://schemas.android.com/apk/lib/mapbox"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".examples.basics.SimpleMapViewActivity">
<!-- Set the starting camera position and map style using xml-->
<com.mapbox.mapboxsdk.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
mapbox:center_latitude="40.73581"
mapbox:center_longitude="-73.99155"
mapbox:style_url="@string/url"
mapbox:zoom="11" />
</RelativeLayout>
请帮帮我。我找了很多,但没找到有用的。提前感谢。您是否在应用程序中使用proguard?为什么不在gradle/maven文件中声明依赖项?首先,右键单击项目,转到项目的属性。然后转到Java构建路径,然后是订单和导出选项卡。查看是否检查了包含的jar。如果没有,那么检查它并再次清理项目并运行。从这里开始-@Dibzmania执行此操作时,我遇到另一个无法执行dex的异常:多个dex文件定义Landroid/support/v7/appcompat/R$anim+eclipse@reebow这个项目已经在Eclipse中完成了,它使用的是旧版本的Mapbox,并且运行良好。现在我想更新Mapboxok。这是因为v7支持库多次包含在您的项目中。我认为您正在使用的库已经在使用v7支持库。如果您的应用程序项目依赖于v7,请删除它并尝试一下