0

首先我用java编写了small然后导出到.jar文件这里是Java代码

package de.vogella.eclipse.ide.first;

public class MyFirstClass {

    /**
     * @param args
     */
    public static void main(String[] args) {
        System.out.println("Hello Eclipse!");

    }

}

然后转换为“myfile.jar”它的工作正常(“Hello Eclipse!”)我在 android 应用程序中调用“myfile.jar”文件但无法在 android 应用程序中获取“MyFirstClass”,Android 代码 main.java

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import de.vogella.eclipse.ide.first.*;  // Here I imported jar file

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }

}
4

1 回答 1

0

本教程将帮助您

http://mobile.tutsplus.com/tutorials/android/jar-for-android/

希望这有帮助

于 2013-01-26T08:02:00.873 回答