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

No static method toHumanReadableAscii #1139

Closed
benjaminkoetting opened this issue Mar 27, 2018 · 40 comments
Closed

No static method toHumanReadableAscii #1139

benjaminkoetting opened this issue Mar 27, 2018 · 40 comments

Comments

@benjaminkoetting
Copy link

got the following error on runtime:

java.lang.NoSuchMethodError: No static method toHumanReadableAscii(Ljava/lang/String;)Ljava/lang/String; in class Lokhttp3/internal/Util

seems to be the same like here:
mapbox/mapbox-java#726
mapbox/mapbox-gl-native#11325

but how to fix it for react native, I installed the package from github:

"@mapbox/react-native-mapbox-gl": "git://github.com/mapbox/react-native-mapbox-gl.git",

Thanks,
Ben

@benjaminkoetting
Copy link
Author

benjaminkoetting commented Mar 27, 2018

tested with

"@mapbox/react-native-mapbox-gl": "^6.1.0",
and
"@mapbox/react-native-mapbox-gl": "6.0.3",

and got the same runtime error

@benjaminkoetting
Copy link
Author

I edit this file:
rctmgl/build.gradle

   compile('com.mapbox.mapboxsdk:mapbox-android-sdk:5.5.1@aar') {
        transitive=true
    }

it was 5.4.1 bevor, and in one post I see it will be fixed in 5.5.0, it seems to work

@krystianpach
Copy link

here is workaround:

build.gradle

compile (project(':mapbox-react-native-mapbox-gl')) {
        compile ('com.squareup.okhttp3:okhttp:3.6.0') {
            force = true
        }
}

@kristfal
Copy link
Collaborator

Just an FYI: updating to Android version 5.5.1 will break the map snapshot functionality. It's probably safer to follow @krystianpach's approach.

@CptFabulouso
Copy link

Running "@mapbox/react-native-mapbox-gl": "^6.1.2-beta2" with this issue, any progress fixing this? What has to be done?

@ferrannp
Copy link

Exact same error with react-native: 0.57.0 and "@mapbox/react-native-mapbox-gl": "^6.1.3". Answer from @Bemazo to update mapbox-android-sdk to 5.5.1 fixes the issue. What should we do?

@kristfal
Copy link
Collaborator

@ferrannp don't upgrade. Follow @krystianpach's approach for now. This will be resolved when we get the latest Android SDK into the RN repo.

@olegdater
Copy link

@krystianpach fixes issue even for react native 0.57.0

@FibreFoX
Copy link

The workaround #1139 (comment) does fix the issue even on RN 0.57.2 :)

@GrosJob
Copy link

GrosJob commented Oct 18, 2018

I cannot get it to work with the workaround on 0.57.3.
I really hope they will do something about it, as people seem to face this issue for a long time now.

@farwayer
Copy link

farwayer commented Oct 18, 2018 via email

@GrosJob
Copy link

GrosJob commented Oct 18, 2018

Thank you for your answer, I started it back from the begenning and got it to work indeed =)

@Heterotroph
Copy link

Heterotroph commented Nov 3, 2018

The workaround does fix crashes, but now map is empty... Did i miss something?
react-native: 0.57.4
screenshot_4

UPD: This was another problem #1041

@PeterSprague
Copy link

After days of beating my head on desk, followed @krystianpach's approach. Works for RN 0.57.3

@Jaydipsinhv
Copy link

Same here...
Thank you so much @krystianpach. its working now...!!!

@giantss
Copy link

giantss commented Nov 19, 2018

Same here.

environment

package.json

...

 "dependencies": {
    "@mapbox/react-native-mapbox-gl": "^6.1.3",
    "react": "16.6.1",
    "react-native": "0.57.5"
  },

...

@krystianpach Compilation can't pass, know what's going on? Thank you very much if you can help me.

image

@giantss
Copy link

giantss commented Nov 19, 2018

Oh my God !!!
@mapbox_react-native-mapbox-gl @mapbox is followed by _ instead of -,
@Bemazo How can there be such a naming method ? Make people puzzled .

image

@kimhafr
Copy link

kimhafr commented Nov 22, 2018

We did @krystianpach's approach and now we're getting a lot of crashes in production. The bug is reported here: square/okhttp#3438, and we really need to use a higher version of okhttp than 3.6.0. Any other way to solve this? Is there a better solution on the way?

Edit Seems to work when forcing 3.9.1 instead. Does not recommend anyone using 3.6.0 for now

@FibreFoX
Copy link

@giantss It depends on what is registered inside the settings.gradle which includes the projects and gives them "new project names". You can define them yourself. We are using these lines, because gradle didn't like the @ sign in the project-name:

include ':mapbox-react-native-mapbox-gl'
project(':mapbox-react-native-mapbox-gl').projectDir = new File(rootProject.projectDir, '../node_modules/@mapbox/react-native-mapbox-gl/android/rctmgl')

@giantss
Copy link

giantss commented Nov 23, 2018

@FibreFoX Thanks. Yes, plugin naming is rarely seen using the @ symbol . I use the way that the react native link is automatically added, the plugin name is with the @ symbol.

include ':mapbox-react-native-mapbox-gl'
project(':mapbox-react-native-mapbox-gl').projectDir = new File(rootProject.projectDir, '../node_modules/@mapbox/react-native-mapbox-gl/android/rctmgl')

This naming is good . 😊

@shrikantkunte
Copy link

here is workaround:

build.gradle

compile (project(':mapbox-react-native-mapbox-gl')) {
        compile ('com.squareup.okhttp3:okhttp:3.6.0') {
            force = true
        }
}

@mapbox_react-native-mapbox-gl @mapbox is followed by _ instead of -,

compile (project(':@mapbox_react-native-mapbox-gl')) {
        compile ('com.squareup.okhttp3:okhttp:3.6.0') {
            force = true
        }
        implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:5.5.1'
     } 

this worked for me.

@ghost
Copy link

ghost commented Dec 23, 2018

@ferrannp don't upgrade. Follow @krystianpach's approach for now. This will be resolved when we get the latest Android SDK into the RN repo.

Hey. Are we going to see this issue fixed? This repo seems to never get updated anymore. RN repo uses very old versions of Mapbox native libraries.

@olegdater
Copy link

Agree, this repo is just stale :( very pity because I like mapbox but this outdated library makes me consider other solutions

@awdhootlele
Copy link

@krystianpach 's workaround works, but can someone please explain me what causes the issue?

@robinvw1
Copy link

Thank you @krystianpach. I tried a newer version of okhttp com.squareup.okhttp3:okhttp:3.11.0, but you specifically need com.squareup.okhttp3:okhttp:3.6.0.

@sfratini
Copy link
Collaborator

sfratini commented Feb 3, 2019

For those that are still having issues after the workaround, I had multiple dependencies using okhttp so that was causing some issues. I forced the version 3.9.1 (which fixes the bug) in the project build.gradle:


allprojects {

    repositories {

        configurations.all {
            resolutionStrategy {
                force "com.squareup.okhttp3:okhttp:3.9.1"
            }
        }
    }

}

@ggerber
Copy link

ggerber commented Feb 6, 2019

Anyone got this working for RN 0.58?

@LintangWisesa
Copy link

here is workaround:

build.gradle

compile (project(':mapbox-react-native-mapbox-gl')) {
        compile ('com.squareup.okhttp3:okhttp:3.6.0') {
            force = true
        }
}

thanks a lot @krystianpach, it works 100% for me using React Native 0.58.4 & Mapbox 6.1.3

@ansarikhurshid786
Copy link

here is workaround:

build.gradle

compile (project(':mapbox-react-native-mapbox-gl')) {
        compile ('com.squareup.okhttp3:okhttp:3.6.0') {
            force = true
        }
}

I am getting error :
compile is not method something like this.

@FibreFoX
Copy link

With upcoming RN 0.59 they updated to a later version of okhttp ... does anyone know if this workaround still works?

@sfratini
Copy link
Collaborator

With upcoming RN 0.59 they updated to a later version of okhttp ... does anyone know if this workaround still works?

See my previous answer. You can force any okhttp version in the project. Just use the same version that RN is using. okhttp fixed this in 3.9.1 so anything after that should be ok.

#1139 (comment)

@ggerber
Copy link

ggerber commented Feb 21, 2019 via email

@farwayer
Copy link

All versions after 3.9.1 throw the error. RN 0.59-rc.2 uses 3.12.1

@horva
Copy link

horva commented Mar 6, 2019

What do you say about mentioning krystianpach's workaround in https://github.com/mapbox/react-native-mapbox-gl/blob/master/android/install.md as known issue and temp solution until it is resolved?

@FrankPu
Copy link

FrankPu commented Mar 11, 2019

finally succeeded

@ggerber
Copy link

ggerber commented Mar 11, 2019 via email

@joshuapinter
Copy link

Oh my God !!!
@mapbox_react-native-mapbox-gl @mapbox is followed by _ instead of -,
@Bemazo How can there be such a naming method ? Make people puzzled .

image

It actually completely depends on what you have in your settings.gradle file:

include ':mapbox-react-native-mapbox-gl'
project(':mapbox-react-native-mapbox-gl').projectDir = new File( rootProject.projectDir, './node_modules/@mapbox/react-native-mapbox-gl/android/rctmgl' )

You could have mapbox_funky-chicken_whoop and it would work, just as long as you call it that in your settings.gradle and then compile it with that name in your build.gradle.

compile project(':mapbox_funky-chicken_whoop') 

@FibreFoX
Copy link

Just for referencing this, the current master-Branch does not need this hacky workaround, as a different version will be used:

https://github.com/nitaliano/react-native-mapbox-gl/pull/1543/files#diff-3cdbb53829ced746d6fe4a3a702677a5R40

@kristfal
Copy link
Collaborator

Yes, please use master, it should be considerably less painful to use on Android.
Note: You may need to force match the version of Okhttp if it is used by your project already.

@joshuapinter
Copy link

Can confirm, works great using master, specifically this last commit is what we're statically versioned to: 8629d43

Thanks!

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