简体   繁体   English

Android Beacon库编译问题

[英]Android beacon library compilation issues

I'm trying to make the Android Beacon Library work for a project but I'm facing a few issues. 我正在尝试使Android Beacon库适用于某个项目,但遇到了一些问题。

I downloaded the library, added it to eclipse and then imported the sample project ( https://github.com/AltBeacon/android-beacon-library-reference ). 我下载了该库,将其添加到eclipse中,然后导入了示例项目( https://github.com/AltBeacon/android-beacon-library-reference )。 Everything was working fine on Linux mint so I developped my own service based on this library. 在Linux Mint上一切正常,因此我基于该库开发了自己的服务。

Then I shared my code with some friends who encountered some issues on windows. 然后,我与一些在Windows上遇到问题的朋友分享了我的代码。 Indeed, eclipse wasn't showing any errors but the apps were crashing (sample app and my own app). 确实,eclipse并未显示任何错误,但是应用程序崩溃了(示例应用程序和我自己的应用程序)。

So I tried to import the project on windows too and the app was crashing too. 因此,我也尝试在Windows上导入项目,并且应用程序也崩溃了。 We tried this on multiple computers. 我们在多台计算机上进行了尝试。 I don't really understand where the errors come from. 我不太了解错误的来源。 Here are the logcats : 这是日志猫:

Sample Project : 样例项目:

11-28 22:23:17.089: D/AndroidRuntime(7145): Shutting down VM
11-28 22:23:17.089: W/dalvikvm(7145): threadid=1: thread exiting with uncaught exception (group=0x41569ba8)
11-28 22:23:17.099: E/AndroidRuntime(7145): FATAL EXCEPTION: main
11-28 22:23:17.099: E/AndroidRuntime(7145): Process: org.altbeacon.beaconreference, PID: 7145
11-28 22:23:17.099: E/AndroidRuntime(7145): java.lang.RuntimeException: Unable to instantiate application org.altbeacon.beaconreference.BeaconReferenceApplication: java.lang.ClassNotFoundException: Didn't find class "org.altbeacon.beaconreference.BeaconReferenceApplication" on path: DexPathList[[zip file "/data/app/org.altbeacon.beaconreference-1.apk"],nativeLibraryDirectories=[/data/app-lib/org.altbeacon.beaconreference-1, /vendor/lib, /system/lib]]
11-28 22:23:17.099: E/AndroidRuntime(7145):     at android.app.LoadedApk.makeApplication(LoadedApk.java:516)
11-28 22:23:17.099: E/AndroidRuntime(7145):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4317)
11-28 22:23:17.099: E/AndroidRuntime(7145):     at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
11-28 22:23:17.099: E/AndroidRuntime(7145):     at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:631)
11-28 22:23:17.099: E/AndroidRuntime(7145):     at android.app.ActivityThread.handleBindApplication(Native Method)
11-28 22:23:17.099: E/AndroidRuntime(7145):     at android.app.ActivityThread.access$1500(ActivityThread.java:135)
11-28 22:23:17.099: E/AndroidRuntime(7145):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
11-28 22:23:17.099: E/AndroidRuntime(7145):     at android.os.Handler.dispatchMessage(Handler.java:102)
11-28 22:23:17.099: E/AndroidRuntime(7145):     at android.os.Looper.loop(Looper.java:136)
11-28 22:23:17.099: E/AndroidRuntime(7145):     at android.app.ActivityThread.main(ActivityThread.java:5017)
11-28 22:23:17.099: E/AndroidRuntime(7145):     at java.lang.reflect.Method.invokeNative(Native Method)
11-28 22:23:17.099: E/AndroidRuntime(7145):     at java.lang.reflect.Method.invoke(Method.java:515)
11-28 22:23:17.099: E/AndroidRuntime(7145):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
11-28 22:23:17.099: E/AndroidRuntime(7145):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
11-28 22:23:17.099: E/AndroidRuntime(7145):     at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
11-28 22:23:17.099: E/AndroidRuntime(7145):     at dalvik.system.NativeStart.main(Native Method)
11-28 22:23:17.099: E/AndroidRuntime(7145): Caused by: java.lang.ClassNotFoundException: Didn't find class "org.altbeacon.beaconreference.BeaconReferenceApplication" on path: DexPathList[[zip file "/data/app/org.altbeacon.beaconreference-1.apk"],nativeLibraryDirectories=[/data/app-lib/org.altbeacon.beaconreference-1, /vendor/lib, /system/lib]]
11-28 22:23:17.099: E/AndroidRuntime(7145):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
11-28 22:23:17.099: E/AndroidRuntime(7145):     at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
11-28 22:23:17.099: E/AndroidRuntime(7145):     at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
11-28 22:23:17.099: E/AndroidRuntime(7145):     at android.app.Instrumentation.newApplication(Instrumentation.java:975)
11-28 22:23:17.099: E/AndroidRuntime(7145):     at android.app.LoadedApk.makeApplication(LoadedApk.java:511)
11-28 22:23:17.099: E/AndroidRuntime(7145):     ... 15 more

Own Project : 自己的项目:

11-28 22:29:05.230: I/dalvikvm(8591): Failed resolving Lcom/eirb/projets9/scanner/RangingService; interface 772 'Lorg/altbeacon/beacon/BeaconConsumer;'
11-28 22:29:05.230: W/dalvikvm(8591): Link of class 'Lcom/eirb/projets9/scanner/RangingService;' failed
11-28 22:29:05.230: E/dalvikvm(8591): Could not find class 'com.eirb.projets9.scanner.RangingService', referenced from method com.eirb.projets9.MainActivity.onCreate
11-28 22:29:05.230: W/dalvikvm(8591): VFY: unable to resolve const-class 673 (Lcom/eirb/projets9/scanner/RangingService;) in Lcom/eirb/projets9/MainActivity;
11-28 22:29:05.230: D/dalvikvm(8591): VFY: replacing opcode 0x1c at 0x000f
11-28 22:29:05.280: D/AndroidRuntime(8591): Shutting down VM
11-28 22:29:05.280: W/dalvikvm(8591): threadid=1: thread exiting with uncaught exception (group=0x41569ba8)
11-28 22:29:05.280: E/AndroidRuntime(8591): FATAL EXCEPTION: main
11-28 22:29:05.280: E/AndroidRuntime(8591): Process: com.eirb.projets9, PID: 8591
11-28 22:29:05.280: E/AndroidRuntime(8591): java.lang.NoClassDefFoundError: com.eirb.projets9.scanner.RangingService
11-28 22:29:05.280: E/AndroidRuntime(8591):     at com.eirb.projets9.MainActivity.onCreate(MainActivity.java:56)
11-28 22:29:05.280: E/AndroidRuntime(8591):     at android.app.Activity.performCreate(Activity.java:5231)
11-28 22:29:05.280: E/AndroidRuntime(8591):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
11-28 22:29:05.280: E/AndroidRuntime(8591):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
11-28 22:29:05.280: E/AndroidRuntime(8591):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
11-28 22:29:05.280: E/AndroidRuntime(8591):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
11-28 22:29:05.280: E/AndroidRuntime(8591):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
11-28 22:29:05.280: E/AndroidRuntime(8591):     at android.os.Handler.dispatchMessage(Handler.java:102)
11-28 22:29:05.280: E/AndroidRuntime(8591):     at android.os.Looper.loop(Looper.java:136)
11-28 22:29:05.280: E/AndroidRuntime(8591):     at android.app.ActivityThread.main(ActivityThread.java:5017)
11-28 22:29:05.280: E/AndroidRuntime(8591):     at java.lang.reflect.Method.invokeNative(Native Method)
11-28 22:29:05.280: E/AndroidRuntime(8591):     at java.lang.reflect.Method.invoke(Method.java:515)
11-28 22:29:05.280: E/AndroidRuntime(8591):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
11-28 22:29:05.280: E/AndroidRuntime(8591):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
11-28 22:29:05.280: E/AndroidRuntime(8591):     at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
11-28 22:29:05.280: E/AndroidRuntime(8591):     at dalvik.system.NativeStart.main(Native Method)

As I said the app is running well when compiled from linux. 正如我所说的,从linux编译时,该应用程序运行良好。 I tried to modify the order of imports. 我试图修改导入顺序。

Do you have any idea where do these errors come from ? 您是否知道这些错误来自何处?

I solved my problem by updating the ADT plugin and the SDK tools. 我通过更新ADT插件和SDK工具解决了我的问题。

I updated my ADT from the 22.6 version to the 23.0.2 because I couldn't get the latest versions of the SDK tools. 我无法将ADT从22.6版本更新为23.0.2,因为我无法获得最新版本的SDK工具。

Then, I installed : 然后,我安装了:

  • Android SDK Tools rev 23.0.5 Android SDK工具修订版23.0.5
  • Android SDK Platform-tools rev 21 Android SDK平台工具修订版21
  • Android SDK Build-Tools rev 21.1.1 Android SDK构建工具版本21.1.1

I also installed the Android APIs 20 and 21 but don't think that it changes anything. 我还安装了Android API 20和21,但不要认为它会改变任何东西。

Don't forget to restart eclipse and clean your workspace. 不要忘记重启Eclipse并清理工作区。 I tried this on 4 computers and it worked for all of them. 我在4台计算机上进行了尝试,并且对所有计算机都有效。

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

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