Skip to content
This repository has been archived by the owner on Jul 3, 2021. It is now read-only.

Code doesn't work on android, didn't check for ios #2

Closed
AtulKondekar opened this issue Mar 21, 2018 · 14 comments
Closed

Code doesn't work on android, didn't check for ios #2

AtulKondekar opened this issue Mar 21, 2018 · 14 comments
Assignees
Labels
bug Something isn't working

Comments

@AtulKondekar
Copy link

code doesn't work even after adding following code.

include ':siriwaveview' project(':siriwaveview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-siri-wave-view/android/SIRIWaveView/siriwaveview')

Looks like the package java file is missing in com.alex.siriwaveview

@prscX
Copy link
Owner

prscX commented Mar 21, 2018

Thanks @AtulKondekar for raising the issue.

Can you please share the screenshot of issue which you are getting. Are you trying to run the app from command line?

Thanks
Pranav

@AtulKondekar
Copy link
Author

AtulKondekar commented Mar 22, 2018

I would like to thank you for your quick response.
I get the following error after replacing above mentioned lines

imageedit_1_7401886727

then i made change on line number 180 in app/build replacing
compile project(':react-native-siri-wave-view')
with
compile project(':siriwaveview')
then i got following error:

imageedit_2_9543714605

then i checked in node module there is no RNSiriWaveViewPackage file present in node module
screenshot from 2018-03-22 10 54 44

Regards,
Atul

@prscX
Copy link
Owner

prscX commented Mar 22, 2018

Thanks @AtulKondekar for sharing the entire details.

The issue was related to gradle version, I have updated the same in master, can you please install master repo and verify the same. Once it is verified I will release the same.

P.S:

  • Please make sure that your app gradle version in build.gradle 2.3.3 and above
  • Please make sure that your app compile version is SDK > 25 and above

You can refer example project for the gradle & SDK version.

Let me know in case you still face the same.

Thanks
Pranav

@AtulKondekar
Copy link
Author

AtulKondekar commented Mar 22, 2018

@prscX I checked it again using the master code but i still get the same issue,
I think the issue is created because of missing RNSiriWaveViewPackage.java file in com.alex.siriwaveview

my build gradle version is 2.3.3 and sdk is 25.0.3

@prscX
Copy link
Owner

prscX commented Mar 22, 2018

Hi @AtulKondekar,

My Bad, few changes were not pushed, can you please try the same by updating master.

Please let me know in case you still face the same issue.

Thanks
Pranav

@AtulKondekar
Copy link
Author

AtulKondekar commented Mar 23, 2018

I tried to run the master code but it still not working, i am getting the same error as above and i checked the com.alex.siriwaveview package, it is still missing RNSiriWaveViewPackage.java.

@prscX
Copy link
Owner

prscX commented Mar 23, 2018

Hi @AtulKondekar,

Looks like some issue with react-native link react-native-siri-wave-view command, it is not working as expected. Can you please try below solutions:

  • Please replace import com.alex.siriwaveview.RNSiriWaveViewPackage; with import ui.siriwave.RNSiriWaveViewPackage; in your app Android MainApplication.java class

  • Add below :siriwaveview in your app build.gradle depenencies:

dependencies {
    compile project(':siriwaveview')
    compile project(':react-native-siri-wave-view')
    compile fileTree(dir: "libs", include: ["*.jar"])
}

Please let me know in case it does not resolve the issue. I have also added the same in README

Thanks
Pranav

@AtulKondekar
Copy link
Author

AtulKondekar commented Mar 23, 2018

Hi @prscX ,

The code work for me when i included both the project path in settings.gradle of my project

include ':siriwaveview'
project(':siriwaveview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-siri-wave-view/android/SIRIWaveView/siriwaveview')
include ':react-native-siri-wave-view'
project(':react-native-siri-wave-view').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-siri-wave-view/android')

and i had to compile both the projects in app/build.gradle
compile project(':react-native-siri-wave-view')
compile project(':siriwaveview')

then replaced
import com.alex.siriwaveview.RNSiriWaveViewPackage;
with
import ui.siriwave.RNSiriWaveViewPackage;
in your app Android MainApplication.java class

But startAnimation and stopAnimation props are not working if i pass true;
I checked the android java code in RNSiriWaveView.java

@ReactProp(name = "stopAnimation")
    public void setStopAnimation(FrameLayout SiriWaveViewFrame, boolean stopAnimation) {
        SiriWaveView siriWaveView = (SiriWaveView) SiriWaveViewFrame.getChildAt(0);
        if (stopAnimation) {
          siriWaveView.stopAnimation();
        }
    }

i am getting an error saying siriWaveView.stopAnimation(); can't read stopAnimation of undefined.

Regards,
Atul K

@prscX
Copy link
Owner

prscX commented Mar 24, 2018

Thanks @AtulKondekar for sharing the experience. I have updated README with the same, hope it will help other folks experiencing the same.

I have made below fixes in order to handle NullPointerException:

SiriWaveView siriWaveView = (SiriWaveView) SiriWaveViewFrame.getChildAt(0);
if (siriWaveView != null && animating == true && stopAnimation) {
    animating = false;
    siriWaveView.stopAnimation();
}

Can you please update your source to verify the same, once it is verified I will push the release.

Thanks
Pranav

@AtulKondekar
Copy link
Author

AtulKondekar commented Mar 26, 2018

Hi @prscX ,

I made the above mentioned changes. now code doesn't throw an error if it's ture but the methods setStartAnimation and setStopAnimation does not work because siriWaveView is always returns null so it doesn't execute the if block.

Regards,
Atul

@prscX
Copy link
Owner

prscX commented Mar 26, 2018

Hi @AtulKondekar,

As per my understanding React Native is calling these method in some random order due to which the call is first coming to startAnimation , stopAnimation and then propsmethod is getting called.

In order to Start & Stop Animation may be we can achieve this post componentDidMount event, please refer below class where I am triggering event based on button click and the same can be done in componentDidMount

App.js

Please let me know in case it does not work.

Thanks
Pranav

@AtulKondekar
Copy link
Author

Hi @prscX ,

Thank you for the changes code is working now.

Regards,
Atul

@prscX
Copy link
Owner

prscX commented Mar 26, 2018

Thanks, I will push the release.

Thanks
Pranav

@prscX
Copy link
Owner

prscX commented Mar 26, 2018

Hi @AtulKondekar, I have pushed the release with 0.0.3 tag. Can you please install and verify.

Please feel free to reach in case you face any issues.

Thanks
Pranav

@prscX prscX closed this as completed Mar 26, 2018
@prscX prscX self-assigned this Mar 26, 2018
@prscX prscX added the bug Something isn't working label Mar 26, 2018
@prscX prscX mentioned this issue Mar 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants