Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio importing library Gradle: error: package org.simpleframework.xml does not exist

I can't make project in Android Studio. When compile project I have some errors:

Gradle: error: package org.simpleframework.xml does not exist
Gradle: error: cannot find symbol class Element
Gradle: error: cannot find symbol class Element

I add jar manually and from Dependencies to project.

How to fix it ?!

OK, I fix It. The problem was solved. I add manually to config file library libs/simple-xml-2.7.jar.

dependencies {
    compile files('libs/android-support-v4.jar', 'libs/commons-net-3.3.jar', 'libs/simple-xml-2.7.jar')
}
like image 808
Nerus Avatar asked Nov 02 '22 18:11

Nerus


1 Answers

You could also use Maven to declare that dependency in your build.gradle, like this:

dependencies {
    [...]
    compile 'org.simpleframework:simple-xml:2.7'
}

also make sure that you have maven central declared as a repository:

repositories {
    [...]
    mavenCentral()
}

Another common solution if you want to download the .jars by yourself is to include any .jar inside libs/, like that:

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    [...]
}

Anyway, make sure that you don't include a library more than once, that could cause problems.

like image 165
Luca Vitucci Avatar answered Nov 11 '22 13:11

Luca Vitucci