Javax Content Not Accessible
I have a runtime error when i try to run my android application, due to the importation of this package that allows me to use Watson Services. 'com.ibm.watson.developer_cloud:java-
Solution 1:
I think you are using a version older than 2.7.1
. I'm unable to reproduce your problem and I tried with different configurations including yours.
Make sure you clean your workspace and get the latest version of the library.
In your build.gradle
you should have:
compile'com.ibm.watson.developer_cloud:java-sdk:2.9.0'
Here is the commit that fixed your issue. The fix was released in the 2.7.1
version.
This is what I did and that worked for me:
Steps to use the Watson APIs in Android you should:
- Download and install Android Studio
- Open Android Studio
File > New > New Project
.- Pick a name and click
next
,next
,next
andFinish
In
<project-name>/app/build.gradle
add:compile'com.ibm.watson.developer_cloud:java-sdk:2.9.0'
In
MainActiviy.java
at the end ofonCreate(...)
add:Threadthread=newThread(newRunnable(){ @Overridepublicvoidrun() { try { SpeechToTextservice=newSpeechToText(); service.setUsernameAndPassword("<username>", "<password>"); System.out.println(service.getModels()); } catch (Exception e) { e.printStackTrace(); } } }); thread.start();
Start the simulator and look at the console. You should see a message like
I/CredentialUtils: JNDI string lookups isnot available.
and the Speech to Text model list.
I/System.out: [{ I/System.out: "name": "en-US_NarrowbandModel", I/System.out: "rate": 8000 I/System.out: }, { I/System.out: "name": "pt-BR_BroadbandModel", I/System.out: "rate": 16000 I/System.out: }, { I/System.out: .... more models here I/System.out: }, { I/System.out: "name": "en-US_BroadbandModel", I/System.out: "rate": 16000 I/System.out: }]
Post a Comment for "Javax Content Not Accessible"