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

Build issue on Android #23

Open
pvanliefland opened this issue Oct 4, 2016 · 12 comments
Open

Build issue on Android #23

pvanliefland opened this issue Oct 4, 2016 · 12 comments

Comments

@pvanliefland
Copy link

Hello,

After letting Android Studio update various things (SDK, SDK tools etc...), my app does not build anymore.

The error I get is

/Users/my-user/Reactnative/my-project/node_modules/react-native-photo-view/android/src/main/java/com/reactnative/photoview/ImageEvent.java:37: error: no suitable constructor found for Event(int)
    super(viewId);
    ^
    constructor Event.Event() is not applicable
      (actual and formal argument lists differ in length)
    constructor Event.Event(int,long) is not applicable
      (actual and formal argument lists differ in length)

Looks like the class constructor of the Event class extended by ImageEvent now expects two arguments.

As a workaround, I did this

public ImageEvent(int viewId, @ImageEventType int eventType) {
    super(viewId, eventType);
    mEventType = eventType;
    mMap = null;
  }

Of course, I have no idea about what I'm doing there but at least my app compiles :)

@zfedoran
Copy link

zfedoran commented Oct 5, 2016

@pvanliefland Which version of ReactNative are you on?

@rwillemsandroid
Copy link

I've run into the same issue running the following version(s):

"react": "15.2.1",
"react-native": "0.31.0",
"react-native-photo-view": "1.2.0",

@waleedarshad-vf
Copy link

waleedarshad-vf commented Oct 15, 2016

I am using react native 0.27.2 @pvanliefland your solutions works no doubt :)

@waleedarshad-vf
Copy link

@pvanliefland If i add these changes directly in node modules, the next time anyone install same library on my project he will not get any changes, what is the right way to add changes so next time the person who install this library will also get changes that we added manually. @rwillemsandroid if you can help that would be more appreciated as well :)

@pvanliefland
Copy link
Author

@zfedoran I'm having the issue with React Native 0.35.0

@tinajohnson
Copy link

Hello,

I faced the same errors as @pvanliefland while compiling my react-native project but they were resolved by using the workaround he has provided. But now that I try to zoom by pinching the image, my app crashes.

The error I get is:

java.lang.NoSuchMethodError: No direct method <init>(IJ)V in class Lcom/facebook/react/uimanager/events/Event; or its super classes (declaration of 'com.facebook.react.uimanager.events.Event' appears in /data/data/com.reportbee.parent/files/instant-run/dex/slice-com.facebook.react-react-native-0.34.1_0b6c20ec3410a20a85e40c61dad9510f0e6dff75-classes.dex)
                                                                          at com.reactnative.photoview.ImageEvent.<init>(ImageEvent.java:0)
                                                                          at com.reactnative.photoview.PhotoView$4.onScaleChange(PhotoView.java:190)
                                                                          at me.relex.photodraweeview.Attacher.onScale(Attacher.java:328)

My PhotoView component is:

<View style={{ height: heightChange, marginTop: 15, padding: 10, alignItems: 'flex-start' }}>
          {
            this.props.url
            ?

              <PhotoView
                source={{uri: this.props.url}}
                minimumZoomScale={0.5}
                maximumZoomScale={2}
                style={{ height: heightChange / 2, width: width - 20, resizeMode: 'contain' }} />
            :
            <View />
          }
</View>

Is the error because there is no constructor matching Event(viewId, eventType)? Is there a workaround for this error?

@sakshityagi
Copy link

sakshityagi commented Nov 28, 2016

@pvanliefland were you able to fix the issue(not be making changes in node module ofcourse)? I am also getting same errors while building my android app.

Is it react-native version issue?

@px-amaac
Copy link

I know this is a few months old now but This seems to be a react-native version issue. It is not really an issue with this library or RN. Basically upgrade to better versions.
The issue is caused by this PR PR

That PR was a response to this one from RN

When i had this issue it was actually an issue with how i was retrieving react-native library. My library was defaulting to react-native:0.20.1 from here instead of using the local one in my node_modules folder.

That version of RN does not have the change from above that was added I believe in 0.38. My problem was solved after i found this
Essentially i added my local RN maven repo to the buildscript section instead of allprojects. That little detail is easily missed in the docs and will cause this library to fail to build.

@u-kan
Copy link

u-kan commented Apr 29, 2017

my project caused exactly same issue #23

And this solution fix it. So this promlem should be reconsidered

my react native version is 0.43.3

and this pull request, which is closed without mergerd, solve my problem.

I think this issue should be rediscussed now ..

@omairvaiyani
Copy link

If anyone stumbles upon this issue, I boiled the issue to package.json -> "react-native":"...tz"

My boilerplate (ignite) was using a direct .tz link for "react-native", rather than saying "v0.54.0" (or what ever the latest version is when you read this). This change along with a clean npm install allowed me to build successfully.

@gansri
Copy link

gansri commented Jun 14, 2018

i am having similar react native build problems:, Any help to fix this problem will be very helpful.

:app:compileDebugJavaWithJavacE:\chewy\chewy-reactjs\android\app\src\main\java\com\users\MainActivity.java:3: error: package com.facebook.react does not exist
import com.facebook.react.ReactActivity;
^
here are my version:
"react": "16.3.1",
"react-native": "0.55.3",
"react-native-camera": "^1.1.4",
"react-native-elements": "^0.19.1",
"react-native-fbsdk": "^0.7.0",
"react-native-popup-dialog": "^0.11.46",
"react-native-qrcode-scanner": "^1.0.1",
"react-native-slider": "^0.11.0",
"react-native-swipe-recognizer": "^0.2.0",
"react-native-swiper": "^1.5.13",
"react-navigation": "^1.5.11"

@aspidvip
Copy link

aspidvip commented Aug 6, 2018

me to

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

No branches or pull requests