首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

小弟我想用友盟的自动更新,但是不会用,他报错

2013-12-20 
我想用友盟的自动更新,但是不会用,他报错******************************源码***************************

我想用友盟的自动更新,但是不会用,他报错
******************************
源码
******************************

package com.PicGenie;


import com.PicGenie.R;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;

import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;

import com.umeng.update.UmengDialogButtonListener;
import com.umeng.update.UmengDownloadListener;
import com.umeng.update.UmengUpdateAgent;
import com.umeng.update.UmengUpdateListener;
import com.umeng.update.UpdateResponse;
import com.umeng.update.UpdateStatus;
import com.PicGenie.R;

public class ActivityBIL extends Activity {
private ImageView bil;
private ImageView cute;
private ImageView mito;
private ImageView gif;
private ImageView more;
    /*开始绘制界面,BIL界面
     * (non-Javadoc)
     * @see android.app.Activity#onCreate(android.os.Bundle)
     */


/*
 * 友盟更新
 * (non-Javadoc)
 * @see android.app.Activity#onCreate(android.os.Bundle)
 */


@Override

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
    UmengUpdateAgent.update(this);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_bil);
initView();

}

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

// 初始化控件
private void initView() {
cute = (ImageView) findViewById(R.id.cute);
cute.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent();
intent.setClass(getApplicationContext(),ActivityCute.class);
startActivity(intent);
finish();
}
});

gif = (ImageView) findViewById(R.id.gif);
gif.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent();
intent.setClass(getApplicationContext(),ActivityGIF.class);
startActivity(intent);
finish();
}
});

mito = (ImageView) findViewById(R.id.mito);
mito.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent();
intent.setClass(getApplicationContext(),ActivityMito.class);
startActivity(intent);
}
});

more= (ImageView) findViewById(R.id.more);
more.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent();
intent.setClass(getApplicationContext(),ActivityMore.class);
startActivity(intent);
}
});
}
}

*****************************
LogCat
*****************************
12-17 23:17:48.162: D/dalvikvm(1041): GC_FOR_ALLOC freed 68K, 5% free 2808K/2944K, paused 181ms, total 183ms
12-17 23:17:48.222: I/dalvikvm-heap(1041): Grow heap (frag case) to 8.298MB for 5760016-byte allocation
12-17 23:17:48.322: D/dalvikvm(1041): GC_FOR_ALLOC freed <1K, 2% free 8433K/8572K, paused 95ms, total 95ms
12-17 23:17:49.052: D/gralloc_goldfish(1041): Emulator without GPU emulation detected.
12-17 23:17:51.082: D/dalvikvm(1041): GC_FOR_ALLOC freed 5K, 2% free 8457K/8572K, paused 88ms, total 89ms
12-17 23:17:51.212: I/dalvikvm-heap(1041): Grow heap (frag case) to 13.815MB for 5760016-byte allocation
12-17 23:17:51.302: D/dalvikvm(1041): GC_FOR_ALLOC freed <1K, 1% free 14082K/14200K, paused 83ms, total 83ms


12-17 23:17:53.262: D/dalvikvm(1041): GC_FOR_ALLOC freed 17K, 1% free 16112K/16196K, paused 95ms, total 96ms
12-17 23:17:53.872: I/Choreographer(1041): Skipped 83 frames!  The application may be doing too much work on its main thread.
12-17 23:17:56.342: I/Choreographer(1041): Skipped 30 frames!  The application may be doing too much work on its main thread.
12-17 23:18:44.302: I/Choreographer(1041): Skipped 32 frames!  The application may be doing too much work on its main thread.
12-17 23:18:44.592: I/dalvikvm(1041): Could not find method com.umeng.update.UmengUpdateAgent.update, referenced from method com.PicGenie.ActivityBIL.onCreate
12-17 23:18:44.592: W/dalvikvm(1041): VFY: unable to resolve static method 5556: Lcom/umeng/update/UmengUpdateAgent;.update (Landroid/content/Context;)V
12-17 23:18:44.592: D/dalvikvm(1041): VFY: replacing opcode 0x71 at 0x0003
12-17 23:18:44.652: D/AndroidRuntime(1041): Shutting down VM
12-17 23:18:44.652: W/dalvikvm(1041): threadid=1: thread exiting with uncaught exception (group=0xb3aecb90)
12-17 23:18:44.682: E/AndroidRuntime(1041): FATAL EXCEPTION: main
12-17 23:18:44.682: E/AndroidRuntime(1041): Process: com.PicGenie, PID: 1041
12-17 23:18:44.682: E/AndroidRuntime(1041): java.lang.NoClassDefFoundError: com.umeng.update.UmengUpdateAgent
12-17 23:18:44.682: E/AndroidRuntime(1041): at com.PicGenie.ActivityBIL.onCreate(ActivityBIL.java:60)
12-17 23:18:44.682: E/AndroidRuntime(1041): at android.app.Activity.performCreate(Activity.java:5243)
12-17 23:18:44.682: E/AndroidRuntime(1041): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
12-17 23:18:44.682: E/AndroidRuntime(1041): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
12-17 23:18:44.682: E/AndroidRuntime(1041): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
12-17 23:18:44.682: E/AndroidRuntime(1041): at android.app.ActivityThread.access$700(ActivityThread.java:135)
12-17 23:18:44.682: E/AndroidRuntime(1041): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
12-17 23:18:44.682: E/AndroidRuntime(1041): at android.os.Handler.dispatchMessage(Handler.java:102)
12-17 23:18:44.682: E/AndroidRuntime(1041): at android.os.Looper.loop(Looper.java:137)
12-17 23:18:44.682: E/AndroidRuntime(1041): at android.app.ActivityThread.main(ActivityThread.java:4998)
12-17 23:18:44.682: E/AndroidRuntime(1041): at java.lang.reflect.Method.invokeNative(Native Method)
12-17 23:18:44.682: E/AndroidRuntime(1041): at java.lang.reflect.Method.invoke(Method.java:515)
12-17 23:18:44.682: E/AndroidRuntime(1041): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
12-17 23:18:44.682: E/AndroidRuntime(1041): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
12-17 23:18:44.682: E/AndroidRuntime(1041): at dalvik.system.NativeStart.main(Native Method)
12-17 23:19:27.392: I/Process(1041): Sending signal. PID: 1041 SIG: 9


[解决办法]
这个错误是没有将JAR包加入到build path,你将jar放入libs,如果还不行,就需要右键jar包,选择add build path,希望对楼主有帮助
随便求楼主帮忙投一票http://vote.blog.csdn.net/blogstaritem/blogstar2013/xiaanming

热点排行