NoClassDefFoundError的:城市飞艇为Android推 [英] NoClassDefFoundError: Urban Airship for Android Push

查看:119
本文介绍了NoClassDefFoundError的:城市飞艇为Android推的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图建立城市飞艇的天,它真的强调我出去。 由于他们的指示不明确,我只好跟着这个工作,通过。 不过,我目前得到这个errorLogs,并想看看我能找到一些帮助。 请任何建议将不胜AP preciated!谢谢!

  12月10号至18日:41:10.585:E / AndroidRuntime(11870):致命异常:主要
十二月10号至18日:41:10.585:E / AndroidRuntime(11870):java.lang.NoClassDefFoundError的:com.urbanairship.UAirship
十二月10号至18日:41:10.585:E / AndroidRuntime(11870):在com.app.android.NotifyMeApplication.onCreate(NotifyMeApplication.java:15)
十二月10号至18日:41:10.585:E / AndroidRuntime(11870):在android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:973)
十二月10号至18日:41:10.585:E / AndroidRuntime(11870):在android.app.ActivityThread.handleBindApplication(ActivityThread.java:3971)
十二月10号至18日:41:10.585:E / AndroidRuntime(11870):在android.app.ActivityThread.access $ 1300(ActivityThread.java:128)
十二月10号至18日:41:10.585:E / AndroidRuntime(11870):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1199)
十二月10号至18日:41:10.585:E / AndroidRuntime(11870):在android.os.Handler.dispatchMessage(Handler.java:99)
十二月10号至18日:41:10.585:E / AndroidRuntime(11870):在android.os.Looper.loop(Looper.java:137)
十二月10号至18日:41:10.585:E / AndroidRuntime(11870):在android.app.ActivityThread.main(ActivityThread.java:4517)
十二月10号至18日:41:10.585:E / AndroidRuntime(11870):在java.lang.reflect.Method.invokeNative(本机方法)
十二月10号至18日:41:10.585:E / AndroidRuntime(11870):在java.lang.reflect.Method.invoke(Method.java:511)
十二月10号至18日:41:10.585:E / AndroidRuntime(11870):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:980)
十二月10号至18日:41:10.585:E / AndroidRuntime(11870):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
十二月10号至18日:41:10.585:E / AndroidRuntime(11870):在dalvik.system.NativeStart.main(本机方法)
 

我发现了一个类似的<一个href="http://stackoverflow.com/questions/10672263/java-lang-noclassdeffounderror-com-urbanairship-uairship">qnestion和答案,

- 删除从构建路径中所有的Andr​​oid库项目和外部JAR文件。

- 创建一个在您的项目命名为库文件夹中。

-place该文件夹中的所有外部.jar文件,在ADT现在应该把它们放在Android的依赖关系。

-Re导入所有的previous的Andr​​oid库项目的正常方式。

但它不为我工作。

这是Manifestfile,以及应用程序运行正常,如果我删除该应用程序的名称。 但我需要的是,为了使推送通知。

AndroidManifest.xml中

 &lt;应用
        机器人:图标=@可绘制/ ic_launcher
        机器人:标签=@字符串/ APP_NAME
        机器人:名称=com.app.android.NotifyMeApplication
        机器人:可调试=真
        机器人:allowClearUserData =真
        机器人:启用=真正的&GT;
 

NotifyMeApplication.java

 包com.app.android;

进口com.urbanairship.Logger;
进口com.urbanairship.UAirship;
进口com.urbanairship.push.PushManager;
进口com.urbanairship.push.Push preferences;

进口android.app.Application;

公共类NotifyMeApplication扩展应用{

    @覆盖
    公共无效的onCreate(){
        super.onCreate();
                UAirship.takeOff(本); //总是在启动应用程序时需要调用

                即使我们称之为起飞推送通知//默认被禁用
                //你必须明确地打开它们像这样
                PushManager.enablePush();

                //让推管理者了解我们的意图接收器
                PushManager.shared()setIntentReceiver(IntentReceiver.class)。
                //名称必须广播接收器从第7步匹配

                //设置一些preferences的声音和振动
                按preferences preFS = PushManager.shared()得到preferences()。
                prefs.setSoundEnabled(真正的);
                prefs.setVibrateEnabled(真正的);

                // APID为特定设备的唯一标识符
                字符串lPushId = prefs.getPushId();
                Logger.info(我的应用程序的onCreate  - 应用APID:+ lPushId);

    }
}
 

解决方案

如果你得到的NoClassDefFoundError 运行期间,那么我怀疑你不包括他们在运行时工作。你必须选中复选框为每个的.jar是这样的:

I've been trying to set up Urban Airship for days and it really stress me out. Since their instruction isn't clear, I had to follow this one to work through. However, I'm currently getting this errorLogs and trying to see if I can find some help. Please any advice would be greatly appreciated! Thank you!

10-18 12:41:10.585: E/AndroidRuntime(11870): FATAL EXCEPTION: main
10-18 12:41:10.585: E/AndroidRuntime(11870): java.lang.NoClassDefFoundError: com.urbanairship.UAirship
10-18 12:41:10.585: E/AndroidRuntime(11870):    at com.app.android.NotifyMeApplication.onCreate(NotifyMeApplication.java:15)
10-18 12:41:10.585: E/AndroidRuntime(11870):    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:973)
10-18 12:41:10.585: E/AndroidRuntime(11870):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3971)
10-18 12:41:10.585: E/AndroidRuntime(11870):    at android.app.ActivityThread.access$1300(ActivityThread.java:128)
10-18 12:41:10.585: E/AndroidRuntime(11870):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1199)
10-18 12:41:10.585: E/AndroidRuntime(11870):    at android.os.Handler.dispatchMessage(Handler.java:99)
10-18 12:41:10.585: E/AndroidRuntime(11870):    at android.os.Looper.loop(Looper.java:137)
10-18 12:41:10.585: E/AndroidRuntime(11870):    at android.app.ActivityThread.main(ActivityThread.java:4517)
10-18 12:41:10.585: E/AndroidRuntime(11870):    at java.lang.reflect.Method.invokeNative(Native Method)
10-18 12:41:10.585: E/AndroidRuntime(11870):    at java.lang.reflect.Method.invoke(Method.java:511)
10-18 12:41:10.585: E/AndroidRuntime(11870):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
10-18 12:41:10.585: E/AndroidRuntime(11870):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
10-18 12:41:10.585: E/AndroidRuntime(11870):    at dalvik.system.NativeStart.main(Native Method)

I found a similar qnestion and answers,

-Remove all Android Library projects and external jars from the build path.

-Create a folder named 'libs' in your project.

-Place all external .jars in that folder, the ADT should now place them under 'Android Dependencies'.

-Re-import all your previous Android Library projects the normal way.

but it doesn't work for me.

This is Manifestfile, and the application runs fine if i remove the application name. But I need that in order to enable the push notification..

AndroidManifest.xml

<application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" 
        android:name="com.app.android.NotifyMeApplication"
        android:debuggable="true"
        android:allowClearUserData="true"
        android:enabled="true" >

NotifyMeApplication.java

package com.app.android;

import com.urbanairship.Logger;
import com.urbanairship.UAirship;
import com.urbanairship.push.PushManager;
import com.urbanairship.push.PushPreferences;

import android.app.Application;

public class NotifyMeApplication extends Application{

    @Override
    public void onCreate() {
        super.onCreate();
                UAirship.takeOff(this); // always needs to be called when starting an application

                // even though we call takeoff push notifications are disabled by default
                // you have to explicitly turn them on like so
                PushManager.enablePush();

                // let the push manager know about our intent receiver
                PushManager.shared().setIntentReceiver(IntentReceiver.class); 
                // name must match broadcast receiver from step 7

                // set some preferences for sounds and vibration
                PushPreferences prefs = PushManager.shared().getPreferences();
                prefs.setSoundEnabled(true);
                prefs.setVibrateEnabled(true);

                // apid is a unique identifier for a particular device
                String lPushId = prefs.getPushId();
                Logger.info("My Application onCreate - App APID: " + lPushId);

    }
}

解决方案

If you get NoClassDefFoundError during Runtime, then I suspect you did not include them to work at runtime. You have to check the checkbox for each .jar like this:

这篇关于NoClassDefFoundError的:城市飞艇为Android推的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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