我是ubuntu的新手,我使用的是ubuntu 14:04。 android应用程序之前能够在Windows上运行,我不知道为什么ubuntu应用程序,这些应用程序无法运行。问候
这是我的mainactivity.java
package com.iv.daging;
import com.special.ResideMenu.ResideMenu;
import com.special.ResideMenu.ResideMenuItem;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Toast;
import android.os.Bundle;
public class MainActivity extends FragmentActivity implements View.OnClickListener{
private ResideMenu resideMenu;
private MainActivity mContext;
private ResideMenuItem itemHome;
private ResideMenuItem itemIdentification;
private ResideMenuItem itemRecent;
private ResideMenuItem itemAbout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mContext = this;
setUpMenu();
if( savedInstanceState == null )
changeFragment(new HomeFragment());
}
@Override
public void onClick(View view) {
if (view == itemHome){
changeFragment(new HomeFragment());
}else if (view == itemIdentification){
changeFragment(new IdetificationFragment());
}else if (view == itemRecent){
changeFragment(new RecentFragment());
}else if (view == itemAbout){
changeFragment(new AboutFragment());
}
resideMenu.closeMenu();
}
private void changeFragment(Fragment targetFragment){
resideMenu.clearIgnoredViewList();
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.main_fragment, targetFragment, "fragment")
.setTransitionStyle(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
.commit();
}
// What good method is to access resideMenu?
public ResideMenu getResideMenu(){
return resideMenu;
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
return resideMenu.dispatchTouchEvent(ev);
}
private void setUpMenu() {
// attach to current activity;
resideMenu = new ResideMenu(this);
resideMenu.setBackground(R.drawable.menu_background);
resideMenu.attachToActivity(this);
resideMenu.setMenuListener(menuListener);
//valid scale factor is between 0.0f and 1.0f. leftmenu'width is 150dip.
resideMenu.setScaleValue(0.6f);
// create menu items;
itemHome = new ResideMenuItem(this, R.drawable.icon_home,"Home");
itemIdentification = new ResideMenuItem(this, R.drawable.icon_home,"Identification");
itemRecent = new ResideMenuItem(this, R.drawable.icon_home,"Recent");
itemAbout = new ResideMenuItem(this, R.drawable.icon_home,"About");
itemHome.setOnClickListener(this);
itemIdentification.setOnClickListener(this);
itemRecent.setOnClickListener(this);
itemAbout.setOnClickListener(this);
resideMenu.addMenuItem(itemHome, ResideMenu.DIRECTION_RIGHT);
resideMenu.addMenuItem(itemIdentification, ResideMenu.DIRECTION_RIGHT);
resideMenu.addMenuItem(itemRecent, ResideMenu.DIRECTION_RIGHT);
resideMenu.addMenuItem(itemAbout, ResideMenu.DIRECTION_RIGHT);
}
private ResideMenu.OnMenuListener menuListener = new ResideMenu.OnMenuListener() {
@Override
public void openMenu() {
Toast.makeText(mContext, "Menu is opened!", Toast.LENGTH_SHORT).show();
}
@Override
public void closeMenu() {
Toast.makeText(mContext, "Menu is closed!", Toast.LENGTH_SHORT).show();
}
};
}
这是我的longcat:
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.iv.daging/com.iv.daging.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.iv.daging.MainActivity" on path: DexPathList[[zip file "/data/app/com.iv.daging-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.iv.daging-2, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395)
at android.app.ActivityThread.access$600(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5371)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.iv.daging.MainActivity" on path: DexPathList[[zip file "/data/app/com.iv.daging-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.iv.daging-2, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2260)
... 11 more
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.iv.daging/com.iv.daging.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.iv.daging.MainActivity" on path: DexPathList[[zip file "/data/app/com.iv.daging-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.iv.daging-2, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395)
at android.app.ActivityThread.access$600(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5371)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.iv.daging.MainActivity" on path: DexPathList[[zip file "/data/app/com.iv.daging-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.iv.daging-2, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2260)
... 11 more
非常感谢兄弟们
答案 0 :(得分:0)
大多数情况下,问题是班级冲突/不是最新的。这些是我现在可以想到的选择。
答案 1 :(得分:0)
最后我已经完成了,我只是在Jar不匹配中修复依赖关系!这是我的解决方案Jar mismatch! Fix your dependencies