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

Unable to build in Android: unreported exception JSONException #1003

Closed
faxioman opened this issue Jun 13, 2020 · 15 comments · Fixed by #1006
Closed

Unable to build in Android: unreported exception JSONException #1003

faxioman opened this issue Jun 13, 2020 · 15 comments · Fixed by #1006

Comments

@faxioman
Copy link

faxioman commented Jun 13, 2020

Description:
Unable to build android app:

/Users/fabio/Documents/Progetti/iOS/country-italia-app/node_modules/react-native-onesignal/android/src/main/java/com/geektime/rnonesignalandroid/RNOneSignal.java:489: error: unreported exception JSONException; must be caught or declared to be thrown
callback.invoke(RNUtils.jsonToWritableMap(outcomeEvent.toJSONObject()));
^
/Users/fabio/Documents/Progetti/iOS/country-italia-app/node_modules/react-native-onesignal/android/src/main/java/com/geektime/rnonesignalandroid/RNOneSignal.java:502: error: unreported exception JSONException; must be caught or declared to be thrown
callback.invoke(RNUtils.jsonToWritableMap(outcomeEvent.toJSONObject()));
^
/Users/fabio/Documents/Progetti/iOS/country-italia-app/node_modules/react-native-onesignal/android/src/main/java/com/geektime/rnonesignalandroid/RNOneSignal.java:515: error: unreported exception JSONException; must be caught or declared to be thrown

Environment
React Native: 0.62.2

buildToolsVersion = "28.0.3"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29

react-native-onesignal: 3.8.0

Steps to Reproduce Issue:
Try to build

@uusa35
Copy link

uusa35 commented Jun 13, 2020

i confirm i receive the same error

@renatomiguelsantos
Copy link

The same is happening to me

@martin-gazzara
Copy link

Hi, folks!

I've reverted react-native-onesignal to v 3.7.3 and it's working for me.

If you agree with that, you can do the same, meanwhile OneSignal's devs answer us.

@renatomiguelsantos
Copy link

Hi, folks!

I've reverted react-native-onesignal to v 3.7.3 and it's working for me.

If you agree with that, you can do the same, meanwhile OneSignal's devs answer us.

Downgrading to v 3.7.3 didn't work to me.
Even when trying to run the example project described in the documentation I get the same error. Also tried with a fresh install of react native, following the installation steps in the documentation but no luck.
The build works fine if I uninstall react-native-onesignal.

@iomier
Copy link

iomier commented Jun 14, 2020

Hi, folks!

I've reverted react-native-onesignal to v 3.7.3 and it's working for me.

If you agree with that, you can do the same, meanwhile OneSignal's devs answer us.

It Worked for me.

@usmansbk
Copy link

usmansbk commented Jun 14, 2020

Downgrading to 3.7.3 worked

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal 
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.99.99]'
    }
}

@martin-gazzara
Copy link

Downgrading to v 3.7.3 didn't work to me.
Even when trying to run the example project described in the documentation I get the same error. Also tried with a fresh install of react native, following the installation steps in the documentation but no luck.
The build works fine if I uninstall react-native-onesignal.

After downgrading, are you getting the same error? Did you delete node_modules folder and package-lock.json?

@renatomiguelsantos
Copy link

renatomiguelsantos commented Jun 14, 2020

Downgrading to v 3.7.3 didn't work to me.
Even when trying to run the example project described in the documentation I get the same error. Also tried with a fresh install of react native, following the installation steps in the documentation but no luck.
The build works fine if I uninstall react-native-onesignal.

After downgrading, are you getting the same error? Did you delete node_modules folder and package-lock.json?

I was stupidly including the react-native-onesignal version in the package.json file as "react-native-onesignal": "^3.7.3", which was actually installing the latest version.
After I removed the caret (^) and set it just "3.7.3" the error was gone and it now builds successfully. Can't believe I lost all this time due to this stupid mistake.
So I confirm that version 3.7.3 works fine but 3.8.0 does not.
Thanks for all the replies.

@uusa35
Copy link

uusa35 commented Jun 14, 2020

downgrading to 3.7.3 worked for me

@martin-gazzara
Copy link

I was stupidly including the react-native-onesignal version in the package.json file as "react-native-onesignal": "^3.7.3", which was actually installing the latest version.
After I removed the caret (^) and set it just "3.7.3" the error was gone and it now builds successfully. Can't believe I lost all this time due to this stupid mistake.
So I confirm that version 3.7.3 works fine but 3.8.0 does not.
Thanks for all the replies.

I'm glad to hear it!

I hope the downgrading doesn't affect the functionality

@andrealencar
Copy link

Hi,

Attention put the written version "3.7.3"" and not "3.7.3", it worked here

@congnt148
Copy link

The same is happening to me T.T

@mikechoch
Copy link
Contributor

Thank you for all of the information working on a fix for this now. Seems we reorganized some of our outcome event tracking and ended up moving the try-catch responsibility (for error logging) into a controller rather than the class itself now.

Be on the look out for a new release 3.8.1

@denisonfer
Copy link

Hey Downgrade to 3.7.3 dont work for me ?
RN: 0.62.2,

buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
googlePlayServicesAuthVersion = "16.0.1"

@martin-gazzara
Copy link

@mikechoch thanks for the fix!!

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

Successfully merging a pull request may close this issue.

10 participants