无差错dalvik.system.PathClassLoader [数据/应用/ com.my.appname-2.apk] [英] error- dalvik.system.PathClassLoader [data/app/com.my.appname-2.apk]

查看:172
本文介绍了无差错dalvik.system.PathClassLoader [数据/应用/ com.my.appname-2.apk]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索了很多类似那样的错误,但我没有得到它的解决方案。我只要我启动应用程序收到此错误

I searched a lot for similar kind of error, but I am not getting a solution for it. I am getting this error as soon as I start the app

03-21 10:33:08.100: E/AndroidRuntime(13098): FATAL EXCEPTION: main
03-21 10:33:08.100: E/AndroidRuntime(13098): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.airlife/com.example.airlife.MainActivity}: java.lang.ClassNotFoundException: com.example.airlife.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.airlife-2.apk]
03-21 10:33:08.100: E/AndroidRuntime(13098):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1785)
03-21 10:33:08.100: E/AndroidRuntime(13098):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1893)
03-21 10:33:08.100: E/AndroidRuntime(13098):    at android.app.ActivityThread.access$1500(ActivityThread.java:135)
03-21 10:33:08.100: E/AndroidRuntime(13098):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1054)
03-21 10:33:08.100: E/AndroidRuntime(13098):    at android.os.Handler.dispatchMessage(Handler.java:99)
03-21 10:33:08.100: E/AndroidRuntime(13098):    at android.os.Looper.loop(Looper.java:150)
03-21 10:33:08.100: E/AndroidRuntime(13098):    at android.app.ActivityThread.main(ActivityThread.java:4389)
03-21 10:33:08.100: E/AndroidRuntime(13098):    at java.lang.reflect.Method.invokeNative(Native Method)
03-21 10:33:08.100: E/AndroidRuntime(13098):    at java.lang.reflect.Method.invoke(Method.java:507)
03-21 10:33:08.100: E/AndroidRuntime(13098):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
03-21 10:33:08.100: E/AndroidRuntime(13098):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
03-21 10:33:08.100: E/AndroidRuntime(13098):    at dalvik.system.NativeStart.main(Native Method)
03-21 10:33:08.100: E/AndroidRuntime(13098): Caused by: java.lang.ClassNotFoundException: com.example.airlife.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.airlife-2.apk]
03-21 10:33:08.100: E/AndroidRuntime(13098):    at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
03-21 10:33:08.100: E/AndroidRuntime(13098):    at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
03-21 10:33:08.100: E/AndroidRuntime(13098):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
03-21 10:33:08.100: E/AndroidRuntime(13098):    at android.app.Instrumentation.newActivity(Instrumentation.java:1040)
03-21 10:33:08.100: E/AndroidRuntime(13098):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1777)
03-21 10:33:08.100: E/AndroidRuntime(13098):    ... 11 more

MainActivity.java是这样的。

MainActivity.java is like this

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;
import android.os.Bundle;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Toast;



public class MainActivity extends MapActivity implements OnClickListener{

    private ImageButton mVid,mAgebtn,mWeightbtn,mPicbtn,mMsgbtn,mReqbtn,mHelibtn,mDocbtn,mContextbtn;

    private MapView mapView;

    private MyLocationOverlay myLocationOverlay;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          mapView = (MapView)findViewById(R.id.webview);

          mapView.setBuiltInZoomControls(true);
          myLocationOverlay = new MyLocationOverlay(this, mapView);

          mapView.getOverlays().add(myLocationOverlay);
            mapView.postInvalidate();
            // call convenience method that zooms map on our location
            zoomToMyLocation();



        mAgebtn = (ImageButton) findViewById(R.id.imageView36);
        mWeightbtn = (ImageButton) findViewById(R.id.imageView4);
        mPicbtn = (ImageButton) findViewById(R.id.imageView5);
        mMsgbtn = (ImageButton) findViewById(R.id.imageView6);
        mReqbtn = (ImageButton) findViewById(R.id.imageView32);
        mHelibtn = (ImageButton) findViewById(R.id.btnsearch);
        mDocbtn = (ImageButton) findViewById(R.id.btnprovide);
        mVid = (ImageButton) findViewById(R.id.btnpost);
        mContextbtn = (ImageButton) findViewById(R.id.btnsettings);


         mAgebtn.setOnClickListener(this);
         mWeightbtn.setOnClickListener(this);
         mPicbtn.setOnClickListener(this);
         mMsgbtn.setOnClickListener(this);
         mReqbtn.setOnClickListener(this);
         mHelibtn.setOnClickListener(this);
         mDocbtn.setOnClickListener(this);
         mVid.setOnClickListener(this);
         mContextbtn.setOnClickListener(this);


    }


     @Override
        protected void onResume() {
            super.onResume();
            // when our activity resumes, we want to register for location updates
            myLocationOverlay.enableMyLocation();
        }

        @Override
        protected void onPause() {
            super.onPause();
            // when our activity pauses, we want to remove listening for location updates
            myLocationOverlay.disableMyLocation();
        }

        /**
         * This method zooms to the user's location with a zoom level of 10.
         */
        private void zoomToMyLocation() {
            GeoPoint myLocationGeoPoint = myLocationOverlay.getMyLocation();
            if(myLocationGeoPoint != null) {
                mapView.getController().animateTo(myLocationGeoPoint);
                mapView.getController().setZoom(10);
            }
            else {
                Toast.makeText(this, "Cannot determine location", Toast.LENGTH_SHORT).show();
            }
        }

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub

        }

    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }

清单文件:

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

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />



       <uses-permission android:name="android.permission.WRITE_SETTINGS" />
         <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />



    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher" 
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.airlife.MainActivity"
            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=".playvid" />
          <activity android:name=".Display" />
          <activity android:name=".Video" />
           <activity android:name=".Documents" />
                 <activity android:name=".Contact" />
                 <activity android:name=".FixedMyLocationOverlay" />

    </application>

</manifest>

请告诉我为什么我收到此错误,以及如何解决这个问题。

Please tell me why I am getting this error, and how to solve this.

推荐答案

得到了解决。我已经错过了这个code在我的清单文件

Got the solution. I had missed this code in my manifest file

    <uses-library android:name="com.google.android.maps"/>

这篇关于无差错dalvik.system.PathClassLoader [数据/应用/ com.my.appname-2.apk]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆