作者:jkjkjd_105 | 来源:互联网 | 2023-07-28 10:54
IneedtohaveanolderMavenlibraryofeclipselinkusingAndroidStudio1.2.我需要使用AndroidStudio1
I need to have an older Maven library of eclipselink using Android Studio 1.2.
我需要使用Android Studio 1.2拥有一个旧版的eclipselink Maven库。
When I use the Library Dependency to search for eclipselink, I get the following results:
当我使用Library Dependency搜索eclipselink时,我得到以下结果:
However, this library was compiled using Java 8, so it is not suitable for me.
但是,这个库是使用Java 8编译的,所以它不适合我。
This is my gradle.build file:
这是我的gradle.build文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.myapp"
minSdkVersion 10
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'org.odata4j:odata4j-dist:0.7.0'
provided 'org.eclipse.persistence:eclipselink:2.6.0'
compile 'com.android.support:appcompat-v7:22.1.1'
}
If I change the org.eclipse.persistence:eclipselink:2.6.0 to org.eclipse.persistence:eclipselink:2.1.2, I get this error:
如果我将org.eclipse.persistence:eclipselink:2.6.0更改为org.eclipse.persistence:eclipselink:2.1.2,我收到此错误:
Failed to resolve: org.eclipse.persistence:eclipselink:2.1.2
无法解决:org.eclipse.persistence:eclipselink:2.1.2
How could I use an older version of this library?
我怎么能使用这个库的旧版本?
UPDATE:
I've tried to use v2.4.2 but it couldn't compile, so I downloaded a 2.1.2 jar and added as a file dependency. Now it can't find it, and searches in the SDK library. This Maven/Gradle thing is very, very far from NuGet...
我试过使用v2.4.2但它无法编译,所以我下载了一个2.1.2 jar并添加为文件依赖项。现在它找不到它,并在SDK库中搜索。这个Maven / Gradle的东西离NuGet非常非常远......
This is the gradle file:
这是gradle文件:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/eclipselink-2.1.2.jar')
compile 'org.odata4j:odata4j-dist:0.7.0'
compile 'com.android.support:appcompat-v7:22.1.1'
}
And the message:
并且消息:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find org.eclipse.persistence:eclipselink:2.1.2.
Searched in the following locations:
https://jcenter.bintray.com/org/eclipse/persistence/eclipselink/2.1.2/eclipselink-2.1.2.pom
https://jcenter.bintray.com/org/eclipse/persistence/eclipselink/2.1.2/eclipselink-2.1.2.jar
file:/C:/Users/Nestor/AppData/Local/Android/sdk/extras/android/m2repository/org/eclipse/persistence/eclipselink/2.1.2/eclipselink-2.1.2.pom
file:/C:/Users/Nestor/AppData/Local/Android/sdk/extras/android/m2repository/org/eclipse/persistence/eclipselink/2.1.2/eclipselink-2.1.2.jar
file:/C:/Users/Nestor/AppData/Local/Android/sdk/extras/google/m2repository/org/eclipse/persistence/eclipselink/2.1.2/eclipselink-2.1.2.pom
file:/C:/Users/Nestor/AppData/Local/Android/sdk/extras/google/m2repository/org/eclipse/persistence/eclipselink/2.1.2/eclipselink-2.1.2.jar
Required by:
MyApp:app:unspecified > org.odata4j:odata4j-dist:0.7.0 > org.odata4j:odata4j-core:0.7.0
It just simply ignores the gradle file.
它只是忽略了gradle文件。
UPDATE #2:
I copied the jar to the SDK library. When I build now, I get this error:
我将jar复制到SDK库。当我现在构建时,我收到此错误:
:app:preDexDebug
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.joda.time.DateTimeZone$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
trouble processing "javax/xml/stream/EventFilter.class":
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.
1 error; aborting
Error:Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0\bin\java.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
What should I do?
我该怎么办?
3 个解决方案