TheSoftwareDesignLab / ITDroid

https://thesoftwaredesignlab.github.io/ITDroid/
MIT License
1 stars 1 forks source link

Could not find ./.env on the classpath #2

Open gspeiliu opened 3 years ago

gspeiliu commented 3 years ago

Hi,

I followed the instructions and tried the tool in my local environment. However, it shows the error messages as following when I tried the analysis command. io.github.cdimascio.dotenv.DotEnvException: Could not find ./.env on the classpath at io.github.cdimascio.dotenv.internal.ClasspathHelper.loadFileFromClasspath(ClassPathHelper.kt:37) at io.github.cdimascio.dotenv.internal.DotenvReader.read(DotenvReader.kt:36) at io.github.cdimascio.dotenv.internal.DotenvParser.parse(DotenvParser.kt:26) at io.github.cdimascio.dotenv.DotenvBuilder.load(Dotenv.kt:111) at io.github.cdimascio.dotenv.Dotenv$Instance.load(Dotenv.kt:32) at io.github.cdimascio.dotenv.Dotenv.load(Dotenv.kt) at uniandes.tsdl.itdroid.IBM.IBMTranslator.translate(IBMTranslator.java:49) at uniandes.tsdl.itdroid.translator.Translator.translate(Translator.java:20) at uniandes.tsdl.itdroid.ITDroid.runITDroid(ITDroid.java:152) at uniandes.tsdl.itdroid.ITDroid.main(ITDroid.java:43) Suppressed: io.github.cdimascio.dotenv.DotEnvException: Could not find ./.env on the file system (working directory: /$HOME/ITDroid) at io.github.cdimascio.dotenv.internal.DotenvReader.read(DotenvReader.kt:40) ... 8 more

Do you have any advice?

Thank you.

caev03 commented 3 years ago

Hi!

You need to create a .env file with two keys related to the translation of the strings:

API_KEY="your-api-key" GATEWAY="your-gateway"

both keys are provided by IBM when the Watson Language Translation service is created.

that .env file must be located at the same level of the ITDroid-1.0.0.jar file.

If you have any other problem running the program let me know.

gspeiliu commented 3 years ago

Hi!

You need to create a .env file with two keys related to the translation of the strings:

API_KEY="your-api-key" GATEWAY="your-gateway"

both keys are provided by IBM when the Watson Language Translation service is created.

that .env file must be located at the same level of the ITDroid-1.0.0.jar file.

If you have any other problem running the program let me know.

Where can I generate GATEWAY. It requires API definition (JSON or YAML file) or base path for the API when I tried to generate GATEWAY. Am I right to generate the GATEWAY in the site https://cloud.ibm.com/apis/api-gateway/legacy/new?view=providerView&env_id=ibm:yp:us-south?

Thanks. :-)

caev03 commented 3 years ago

after generatinmg the service, yo can go to https://cloud.ibm.com/resources and under services, you can click on the translation service, It will show you the information of your API key and your url for using the service, that url is what should be use as gateway

gspeiliu commented 3 years ago

Thanks for your quick response. So, you mean I can go to the site https://cloud.ibm.com/resources once I generate the gateway service. However, what is the JSON or YAML file that I can upload to generate the API gateway proxy service? In addition, could you please give us an example of the Gateway and the instructions to generate the necessary keys. Thank you. :-)

caev03 commented 3 years ago

Sorry for not being more clear, you do not need to create a gateway service.

you only need to create a Watson Language Translation service, once that translation service is created you will see the API_KEY and the URL in the main page of your service

Here is a step by step (after creating the Watson Language Translation service):

  1. Go to https://cloud.ibm.com/resources
  2. Under the Service tab you will see the service you just created:

imagen

  1. Click on that service and you will see a box called Credential, where you will find the API_KEY and the URL that is used as GATEWAY:

imagen

  1. Then you can copy those values into the .env file
API_KEY="your_api_key"
GATEWAY="https://api.us-south.language-translator.watson.cloud.ibm.com/instances/3e27b6b9-3384..."
gspeiliu commented 3 years ago

Thanks for your patience. The .env file has been added. However, it shows the error message java.io.FileNotFoundException: /$HOME/ITDroid/results/noTrnsResults/es/result.json (No such file or directory) when I tried to run on my local environment. Actually, it can successfully generate mutated APK (SUCCESS: The mutated APK has been generated.). Do you have any suggestions about the error?

Error messages:

Building mutant Signing mutant SUCCESS: The mutated APK has been generated. Going through your app..............................The app has been inspected java.io.FileNotFoundException: /$HOME/ITDroid/results/trnsResults/en/result.json (No such file or directory) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.(FileInputStream.java:138) at java.io.FileInputStream.(FileInputStream.java:93) at java.io.FileReader.(FileReader.java:58) at uniandes.tsdl.itdroid.model.LayoutGraph.(LayoutGraph.java:44) at uniandes.tsdl.itdroid.ITDroid.runITDroid(ITDroid.java:170) at uniandes.tsdl.itdroid.ITDroid.main(ITDroid.java:43) Inspecting translated versions Inspecting non translated versions Processing ar app version Going through your app...................................The app has been inspected

caev03 commented 3 years ago

Hi, that might be due to an error of the exploration tool, so it might be a missing environment variable.

Make sure that you have Android SDK installed in your computer and that you have the next two environment variables:

  1. AAPT_LOCATION that in mi case is in "Android/Sdk/build-tools/28.0.3/aapt.exe"
  2. ANDROID_HOME that in my case is in "Android/Sdk" -> this is the folder that contains the "emulator" folder
gspeiliu commented 3 years ago

Hi, I find that the error message shows if the emulator quits after one language has been analyzed completely. I cannot open the emulator on time after one language analysis finish before the next language starts to be handled just like the third video clip (ITDroid demo2) on the official site. How can I open the emulator after one language analysis finish while before the next one starts?