我在尝试运行Android应用程序时遇到问题,直到在其构建路径中添加第二个外部库,才能正常运行.由于添加了scoreninja jar,我现在在尝试运行应用程序时得到NoClassDefFoundError.
这是消息:
02-11 21:45:26.154: ERROR/AndroidRuntime(3654): java.lang.NoClassDefFoundError: com.scoreninja.adapter.ScoreNinjaAdapter
Run Code Online (Sandbox Code Playgroud)
由于所有构建脚本都是由Android工具(?)生成的,我不确定除了清理和重建或重启eclipse之外我还能做些什么(我已经尝试了所有这三个).有谁知道我怎么能修改这个?
我试图运行Java应用程序,但收到此错误:
java.lang.ClassNotFoundException:
冒号到达后缺少类的位置.但是,我知道该位置不存在,因为该类位于其他位置.如何更新该课程的路径?它与类路径有关吗?
我正在为android创建两个自定义插件,使用我在plugin.xml中描述的插件.我的plugin.xml文件就好
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="com.my.mybiometric"
version="1.2">
<name>myBiometric</name>
<description>myBiometric Plugin</description>
<license>Apache 2.0</license>
<keywords>media,upload</keywords>
<engines>
<engine name="cordova-android" version=">=3.4.0" />
</engines>
<js-module src="www/js/Media2.js" name="Media2">
<clobbers target="mediaRec.startRecord" />
</js-module>
<js-module src="www/js/VoiceUpload.js" name="VoiceUpload">
<clobbers target="VoiceUpload" />
</js-module>
<!-- android -->
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="Media2">
<param name="android-package" value="com.my.mybiometric.AudioHandler"/>
</feature>
<feature name="VoiceUpload">
<param name="android-package" value="com.my.mybiometric.UploadHandler"/>
</feature>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity
android:name="com.my.mybiometric.myBiometric"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="orientation|screenSize|keyboardHidden">
</activity>
</config-file>
<source-file src="platforms/android/src/com/my/plugins/AudioHandler.java" target-dir="src/com/my/mybiometric" />
<source-file src="platforms/android/src/com/my/plugins/UploadHandler.java" target-dir="src/com/my/mybiometric" />
<source-file src="platforms/android/src/com/my/plugins/AppLog.java" target-dir="src/com/my/mybiometric" />
<source-file src="platforms/android/src/com/my/plugins/MyResponseHandler.java" …Run Code Online (Sandbox Code Playgroud) 我已经要求找出这个问题的解决方案,但我无法得到很好的答案.所以我想更详细地写一个问题.
某些用户有时会出现以下错误.我没有看到它通过几个我测试的Android手机,但我通过谷歌开发者控制台大约每周一次迷恋:(
我试图找出解决这个问题很长一段时间.有些人说它可能是由于SD卡的外在东西或者Singletone的东西.
此外,在上一个问题中,一个感恩的家伙说我应该检查AndroidManifest.xml中Applcation标签的'name'属性.但我已经把包装名称放在上面,所以我不认为这是迷恋的原因.
我一直在测试一个外部SD卡,我将我的应用程序安装到外部SD卡然后卸载.但我无法重新制作.
关于Singletone的东西,我的应用程序不会在任何地方使用Custom Application类的实例.所以我认为Singletone的东西不能成为这个问题的原因.
即使我不知道如何重新制作迷恋,所以我真的需要一份关于它的文件或公共资料.
我确定有人得到这个错误并且已经知道如何解决.因此,请帮助我知道什么是错的,以及我如何解决它.祝你有愉快的一天,谢谢.
错误:
java.lang.RuntimeException: Unable to instantiate
application com.***.***.MyApplication:
java.lang.ClassNotFoundException: com.***.***.MyApplication at
android.app.LoadedApk.makeApplication(LoadedApk.java:501) at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4253)
at android.app.ActivityThread.access$1400(ActivityThread.java:143)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1301)
at android.os.Handler.dispatchMessage(Handler.java:99) at
android.os.Looper.loop(Looper.java:137) at
android.app.ActivityThread.main(ActivityThread.java:4950) at
java.lang.reflect.Method.invokeNative(Native Method) at
java.lang.reflect.Method.invoke(Method.java:511) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:997)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:764) at
dalvik.system.NativeStart.main(Native Method) Caused by:
java.lang.ClassNotFoundException: com.***.***.MyApplication at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501) at
java.lang.ClassLoader.loadClass(ClassLoader.java:461) at
android.app.Instrumentation.newApplication(Instrumentation.java:982)
at android.app.LoadedApk.makeApplication(LoadedApk.java:496) ... 11
more
Run Code Online (Sandbox Code Playgroud)
MyApplication.java:
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
...
}
@Override
public void onTerminate() …Run Code Online (Sandbox Code Playgroud) 我试图在我的Android应用程序中实现一个弹出菜单,这将从Android 2.2支持.所以我用android-support-v7-appcompat支持库来做.但不幸的是我得到了java.lang.NoClassDefFoundError异常.无法解决它,所以任何人都可以帮助我吗?提前致谢!
logcat显示,
06-27 15:40:30.160: E/AndroidRuntime(26985): FATAL EXCEPTION: main
06-27 15:40:30.160: E/AndroidRuntime(26985): java.lang.NoClassDefFoundError: android.support.v7.internal.view.menu.MenuBuilder
06-27 15:40:30.160: E/AndroidRuntime(26985): at android.support.v7.widget.PopupMenu.<init>(PopupMenu.java:66)
06-27 15:40:30.160: E/AndroidRuntime(26985): at com.example.basic.MainActivity$4.onClick(MainActivity.java:401)
06-27 15:40:30.160: E/AndroidRuntime(26985): at android.view.View.performClick(View.java:4421)
06-27 15:40:30.160: E/AndroidRuntime(26985): at android.view.View$PerformClick.run(View.java:17903)
06-27 15:40:30.160: E/AndroidRuntime(26985): at android.os.Handler.handleCallback(Handler.java:730)
06-27 15:40:30.160: E/AndroidRuntime(26985): at android.os.Handler.dispatchMessage(Handler.java:92)
06-27 15:40:30.160: E/AndroidRuntime(26985): at android.os.Looper.loop(Looper.java:213)
06-27 15:40:30.160: E/AndroidRuntime(26985): at android.app.ActivityThread.main(ActivityThread.java:5225)
06-27 15:40:30.160: E/AndroidRuntime(26985): at java.lang.reflect.Method.invokeNative(Native Method)
06-27 15:40:30.160: E/AndroidRuntime(26985): at java.lang.reflect.Method.invoke(Method.java:525)
06-27 15:40:30.160: E/AndroidRuntime(26985): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
06-27 15:40:30.160: E/AndroidRuntime(26985): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
06-27 15:40:30.160: E/AndroidRuntime(26985): at dalvik.system.NativeStart.main(Native …Run Code Online (Sandbox Code Playgroud) 我只需要几分钟时间就可以告诉我这些步骤是否适合在android webview中实现cordova:
编辑:好的我终于让它工作这些是正确的步骤:
1)我创建项目:cordova create hello com.example.hello HelloWorld并输入文件夹
2)cordova platform add android,cordova run android(创建cordova.jar)=>启动应用程序=>设备已准备就绪
3)我使用以下代码在"/ res/layout"中创建cordova_layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<org.apache.cordova.CordovaWebView
android:id="@+id/cordova_web_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
4)导入项目(作为eclipse中的"现有项目")并在导入后添加到主java文件中:
public class HelloWorld extends Activity implements CordovaInterface {
private CordovaWebView cordova_webview;
private String TAG = "CORDOVA_ACTIVITY";
private final ExecutorService threadPool = Executors.newCachedThreadPool();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.cordova_layout);
cordova_webview = (CordovaWebView) findViewById(R.id.cordova_web_view);
// Config.init(this);
String url = "file:///android_asset/www/index.html";
cordova_webview.loadUrl(url, …Run Code Online (Sandbox Code Playgroud)