0

I'm trying to editing some open source files. In one of the files, there is a "import org.apache.regexp.RE" that is causing an error "package org.apache.regexp" does not exist"

Where do include this package in my Android Studio so that the files would work. Thank you.

Here is the gradle file after I downloaded the jakarta-regexp.jar file

compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile files('libs/jakarta-regexp.jar')
Julia
  • 1,207
  • 4
  • 29
  • 47

1 Answers1

0

To import libraries you can use grandle dependency or the libs folder inside app folder
Projects Folder\your app\app\libs\ place your jar files here if you don't see the libs folder inside app create a new folder and name it libs.

if im not mistaken i think you are looking for this jar scroll down and click in jakarta/jakarta-regexp.jar.zip( 29 k) place the jar inside libs and sync your project with granlde by cliking on the grandle icon on the toolbar close to the phone icon

this should fix your problem

Tiago Oliveira
  • 1,582
  • 1
  • 16
  • 31
  • I'm getting an "Configuration with name 'default' not found error after trying to import the file. – Julia Sep 11 '16 at 13:22
  • i tried that i and it worked for me, sorry for asking, you extrated the jar from the zip right? – Tiago Oliveira Sep 11 '16 at 14:56
  • Hi, I fixed the "Configuration" error. But after import the file, I'm still getting the same package not exist error. I added this code to my build.gradle file compile files('libs/jakarta-regexp.jar'). I then clean the project without any problem, but when I tried to rebuild the project, I'm still getting the error. – Julia Sep 11 '16 at 15:37
  • please share your grandle module app, do you have `compile fileTree(include: ['*.jar'], dir: 'libs')` in your grandle dependencies? – Tiago Oliveira Sep 11 '16 at 15:49
  • Yah, I have. This is what I have compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:23.2.1' compile 'com.android.support:design:23.2.1' compile files('libs/jakarta-regexp.jar') – Julia Sep 11 '16 at 15:50
  • are you getting an `DexIndexOverflowException` in your grandle messages? you see the `import org.apache.regexp.RE` as red? – Tiago Oliveira Sep 11 '16 at 16:27
  • Yah, I'm seeing it red saying "cannot resolve symbol regexp" – Julia Sep 11 '16 at 16:35
  • thats wierd i tried with and without files and it worked but try to remove `compile files('libs/jakarta-regexp.jar')` filesTree will compile all jars inside libs – Tiago Oliveira Sep 11 '16 at 21:57
  • I tried that, and it still doesn't work, its really weird. It seems that every jar file doesn't work unless I use absolute path. When I use absolute path, it works fine, but then I'm afraid the apk won't work when I release to production. – Julia Sep 12 '16 at 03:30
  • i also don't understand why it didn't work, for me it worked at first try but if you got it to work thats awsome, compile your app with the realese key and test it (sometimes you can get bugs using the release key that you don't get in debug) , you can also test your app on diferent devices using Samsung Lab Test – Tiago Oliveira Sep 12 '16 at 03:34
  • I was able to generate the apk and install the apk on another device and it worked, but I don't understand why it work since I'm using absolute path in the gradle file. I thought absolute path would only work on my own machine. – Julia Sep 12 '16 at 04:01