Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalStateException - App has not been created yet! #16

Closed
Aaryanverma opened this issue Aug 6, 2018 · 4 comments
Closed

IllegalStateException - App has not been created yet! #16

Aaryanverma opened this issue Aug 6, 2018 · 4 comments

Comments

@Aaryanverma
Copy link

I used this whole code and changed API key with mine but the app is crashing displaying the IllegalStateException("App has not been created yet!"). What should I change? Any possible solution?

@rok-povsic
Copy link
Contributor

Hi @Aaryanverma ,

I've opened the project in Intellij Idea, marked "java" as source, installed Android SDK and some libraries which Intellij Idea automatically suggested, replaced YOUR_API_KEY_HERE and was able to run the project in an emulator. Are you sure you've set up the Android SDK and the other libraries correctly?

image

@Ehsan1997
Copy link

Ehsan1997 commented Aug 6, 2018 via email

@rok-povsic
Copy link
Contributor

Good to hear that, good luck!

@Aaryanverma
Copy link
Author

API key is correct, there is a runtime exception at async task, but I'm not getting the root cause of this error. help me with this.
logcat:
java.lang.RuntimeException: An error occurred while executing doInBackground()

error in code at this line:

new AsyncTask<Void, Void, ClarifaiResponse<List<ClarifaiOutput>>>() {
@OverRide protected ClarifaiResponse<List<ClarifaiOutput>> doInBackground(Void... params) {
// The default Clarifai model that identifies concepts in images
final ConceptModel foodModel = App.get().clarifaiClient().getDefaultModels().foodModel();

    // Use this model to predict, with the image that the user just selected as the input
    return foodModel.predict()
        .withInputs(ClarifaiInput.forImage(ClarifaiImage.of(imageBytes)))
        .executeSync();
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants