简体   繁体   English

Eclipse NoClassDefFoundError

[英]Eclipse NoClassDefFoundError

I'm developing an application using Google Maps. 我正在使用Google Maps开发应用程序。 It references the Google Map Util library project, which references google play services library and appcompat-v7. 它引用了Google Map Util库项目,该项目引用了Google Play服务库和appcompat-v7。 Here is my workspace: 这是我的工作区:

https://www.dropbox.com/s/cwy2o9di7bk74li/Zrzut%20ekranu%202014-12-14%2016.21.07.png?dl=0 https://www.dropbox.com/s/cwy2o9di7bk74li/Zrzut%20ekranu%202014-12-14%2016.21.07.png?dl=0

And yet, if I try to compile and run the application, it instantly crashes, with the following trace: 但是,如果我尝试编译并运行该应用程序,则会立即崩溃,并显示以下跟踪信息:

12-14 16:14:24.063: E/AndroidRuntime(7592): FATAL EXCEPTION: main
12-14 16:14:24.063: E/AndroidRuntime(7592): java.lang.NoClassDefFoundError: com.google.android.gms.maps.model.LatLng
12-14 16:14:24.063: E/AndroidRuntime(7592):     at michal.myapp.activities.StartupScreenActivity.onCreate(StartupScreenActivity.java:36)

So apparently the compiler has trouble finding google play services jars. 因此,显然,编译器很难找到Google Play服务罐。 Any ideas? 有任何想法吗?

Manifest: 表现:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="michal.myapp"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="21" />

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCELEROMETER"/>
<uses-permission android:name="android.permission.CAMERA" />


<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true"/>

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="michal.myapp.activities.MapActivity"
        android:label="@string/app_name" >            
    </activity>

    <activity
        android:name="michal.myapp.activities.StartupScreenActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity android:name="michal.myapp.activities.CameraActivity"
      android:label="@string/app_name"

      android:screenOrientation="portrait">
      <!-- configure this activity to use landscape orientation -->


    </activity>

    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="@string/api_key"/>

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

</application>

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Plus, checked the class folders, and they do exist at the locations pointed in the Manifest. 另外,检查了类文件夹,它们确实存在于清单中所指向的位置。 Okay, I added back Android Private Libraries to the build path (removed them because I had JAR mismatches because of it), but now it seems to work. 好的,我将Android私有库重新添加到了构建路径中(由于存在JAR不匹配而将其删除了),但是现在看来可以了。 I'll mark the answer as correct. 我将答案标记为正确。

您必须遵循Google的正式步骤才能很好地配置库: https : //developers.google.com/maps/documentation/android/start#installing_the_google_maps_android_v2_api

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM