JRE7ライブラリからAndroidプロジェクトにいくつかのjarファイルを追加する必要があります。しかし、例えばrt.jar
がAdroid 2.2 SDKからandroid.jar
と競合しているので、私はこのエラーを取得する:.jarファイルの再パッケージ化
Ill-advised or mistaken usage of a core class (java.* or javax.*) when not building a core library.
This is often due to inadvertently including a core library file in your application's project, when using an IDE (such as Eclipse). If you are sure you're not intentionally defining a core class, then this is the most likely explanation of what's going on.
However, you might actually be trying to define a class in a core namespace, the source of which you may have taken, for example, from a non-Android virtual machine project. This will most assuredly not work. At a minimum, it jeopardizes the compatibility of your app with future versions of the platform. It is also often of questionable legality.
If you really intend to build a core library -- which is only appropriate as part of creating a full virtual machine distribution, as opposed to compiling an application -- then use the "--core-library" option to suppress this error message.
If you go ahead and use "--core-library" but are in fact building an application, then be forewarned that your application will still fail to build or run, at some point. Please be prepared for angry customers who find, for example, that your application ceases to function once they upgrade their operating system. You will be to blame for this problem.
If you are legitimately using some code that happens to be in a core package, then the easiest safe alternative you have is to repackage that code. That is, move the classes in question into your own package namespace. This means that they will never be in conflict with core system classes. JarJar is a tool that may help you in this endeavor. If you find that you cannot do this, then that is an indication that the path you are on will ultimately lead to pain, suffering, grief, and lamentation.
私はいくつかのそれについてのスレッドとJarJarのようなもの、OneJarまたはFatJarが私のために良いかもしれませんが行われている知っています。しかし、私はそれらを動作させる方法を知らず、ドキュメントは実際には(私のために)明らかにしません。私は彼らがAntコマンドを使用していると思いますが、私はいつもEclipse built-in builderを使用していますが、今では上記のAntも何も使用する方法がわかりません。
私の質問は、どうすればこのrt.jarを再パックして、Androidプロジェクトでコンパイルできますか?
ありがとうございました!
EDIT:
オクラホマので、私が達成したいことはAndroidアプリケーションの開発中に使用することができた.jarを作成することですが、(いくつかの機能を簡素化し、本当に重要ではありません)。しかし、標準のJavaプロジェクトにも同じような.jarを追加して、そこでいくつかの関数を使うこともできるようにしたいと考えています。 アプリケーションを書く人は誰でもこの.jarを彼のJavaプロジェクトに追加します - >特定のファイルを生成することができます(インターネットには必要です) - >これらの生成されたファイルはAndroidプロジェクトに追加されます - >後で誰かがこのAndroidアプリを使用するとき、これらのファイルはインターネット(オフライン)を使わずに特定の機能を提供します。
あなたは本当に 'アンドロイドプロジェクトにJREからrt.jar'を含めるべきではありません。コアAndroid SDKを使用して達成できない機能は何ですか? –
関連する質問:http://stackoverflow.com/questions/839435/android-core-library-error –