Attempted to fix androids “ill-advised or mistaken usage of a core class” went bad

前端 未结 5 1675
我寻月下人不归
我寻月下人不归 2020-12-16 17:50

After trying to fix this on my own from what I have seen around the net I cannot still figure out what this means:

[2013-08-15 23:58:27 - StudioTab] Dx 
trou         


        
相关标签:
5条回答
  • 2020-12-16 18:30

    Since some users asked about gradle: In Android Studio, you might be referencing a library from within gradle build, like thus (let us say javax.annotation):

    compile 'javax.annotation:jsr250-api:1.0'
    

    remove (comment out) this call from your dependencies.

    download jar file, include in libs folder and right click to Add as library. You should be right as rain.

    0 讨论(0)
  • 2020-12-16 18:33

    If you are using Maven to build then make sure that your dependency on the android SDK has scope of provided, otherwise you will get this message as DEX tries to include all the classes in the android.jar.

    Ie

      <dependency>
          <groupId>android</groupId>
          <artifactId>android</artifactId>
          <version>4.4.2_r3</version>
          <scope>provided</scope>
      </dependency>
    
    0 讨论(0)
  • 2020-12-16 18:39

    I fixed a similar problem by choosing an alternative set of the dependencies while migrating a project from Eclipse to Android Studio. Initially I used springframework.web and javax.xml.transform to make my code pass the build. But the app aborted immediately at runtime with "Ill-advised" error. Then I replaced those two dependencies with 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE', 'org.codehaus.jackson:jackson-mapper-asl:1.9.13' and 'org.codehaus.jackson:jackson-core-asl:1.9.13'. The problem solved.

    0 讨论(0)
  • 2020-12-16 18:50

    I runs into the similar complains. It turns out that my external library has the same class as those in the android SDK.

    So my resolution is that use customized SDK instead of android SDK.

    To do that, following the following steps: o A, change the directory 'sdk.dir' in local.properties o B, "sync project with SDK files". The button should be able to be located on toolbar. On the popup window, choose "project SDK". o It may ask for downloading platform build tool (depends on definition in build.gradle file. For instance, in the filed of buildToolsVersion, the value is 23.0.3. Android studio may ask for the permission to download it. Allow the download. o Android studio shall be able to compile and build APK.​

    0 讨论(0)
  • 2020-12-16 18:51

    Dalvik JVM does not support the entire API of Oracle JDK. I think javax.* packages aren't available to Android. For example there's no AWT or Swing or Graphics2D of Java on Android.

    From the error, it looks like you app is using this Class: http://docs.oracle.com/javase/7/docs/api/javax/xml/namespace/QName.html

    This shouldn't happen If you set up your IDE to use Android SDK instead of JDK.

    0 讨论(0)
提交回复
热议问题