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

App crashes on Android 5 - Resources$NotFoundException: String resource ID #0x2040002 #461

Closed
saurabhdtu opened this issue Oct 25, 2019 · 23 comments
Labels

Comments

@saurabhdtu
Copy link

The crash is continuously happening for android lollipop micromax and intex devices
here is the stacktrace

com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.WebViewYouTubePlayer. + 25 (WebViewYouTubePlayer.java:25)

  | com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.WebViewYouTubePlayer. + 24 (WebViewYouTubePlayer.java:24)
  | com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.LegacyYouTubePlayerView. + 34 (LegacyYouTubePlayerView.java:34)
  | com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.LegacyYouTubePlayerView. + 31 (LegacyYouTubePlayerView.java:31)
  | com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView. + 30 (YouTubePlayerView.java:30)
  | com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView. + 27 (YouTubePlayerView.java:27)

Please fix it asap

@PierfrancescoSoffritti
Copy link
Owner

This is not very helpful. Let me know how to replicate this issue. Do I just need to run the sample app on any device running Android 5?

@saurabhdtu
Copy link
Author

saurabhdtu commented Oct 26, 2019

Yeah.
Just run this code
YouTubePlayerView youtubePlayerView = new YouTubePlayerView(getContext());
intex, micromax devices with api level less than equal to 22.
Intex - AquaAce mini
Micromax - Canvas 5, Canvas Spark, Canvas juice2

@PierfrancescoSoffritti
Copy link
Owner

Unfortunately I don't own any intex, micromax device.

@anthony3444
Copy link

Hi!

I have the same problem on Android 5.1.1 (HUAWEI Y6) :

Caused by android.content.res.Resources$NotFoundException
String resource ID #0x3040005

Stacktrace:

android.content.res.HwResources.getText (HwResources.java:1299)
android.webkit.WebView.<init> (WebView.java:472)
com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.WebViewYouTubePlayer.<init> (WebViewYouTubePlayer.kt:25)
com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.WebViewYouTubePlayer.<init> (WebViewYouTubePlayer.kt:24)
com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.LegacyYouTubePlayerView.<init> (LegacyYouTubePlayerView.kt:34)
com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.LegacyYouTubePlayerView.<init> (LegacyYouTubePlayerView.kt:31)
com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView.<init> (YouTubePlayerView.kt:30)
com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView.<init> (YouTubePlayerView.kt:28)
java.lang.reflect.Constructor.newInstance (Constructor.java)
android.view.LayoutInflater.inflate (LayoutInflater.java:425)
com.myapp.widget.youtube.YoutubeDialogFragment.onCreateView (YoutubeDialogFragment.java:129)

For information, the view YoutubePlayerView is put on my layout XML (very standard case):

<com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView
                android:id="@+id/video_player"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

Thank you very much for your great library!

@PierfrancescoSoffritti
Copy link
Owner

Hi, this seem to be separate issue. What happens if you remove all Java code (related to the player) and to everything with xml?

<com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView
        android:id="@+id/youtube_player_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        
        app:videoId="S0Q4gqBUs7c"
        app:autoPlay="true"
        app:showFullScreenButton="false" />

@anthony3444
Copy link

Unfortunately I can't test (I don't have this mobile). It was a crash from an user.

This crash appears during Activity layout inflate process. So from this point nothing stuff is done on JAVA into my source code. So I think your idea will have no effect on this bug.

@cuongnb96
Copy link

hi @PierfrancescoSoffritti ,this bug is same as https://stackoverflow.com/questions/58028821/android-q-webview-crash-on-android-5-5-1-api-21-22-resourcesnotfoundexception.your library might use webview ( i just use it,not read the source code).so might have some update for this i guess.hope to see your response!! thanks !

@PierfrancescoSoffritti
Copy link
Owner

Thanks for the link, looks like it's the same issue. I don't know when I will have time to look into it, if someone finds a solution/more info: comments and pull requests are welcome.

@cuongnb96
Copy link

@PierfrancescoSoffritti i create pull request by using Android Studio,but it keep error 403 : no permision

@talklittle
Copy link
Contributor

talklittle commented Nov 5, 2019

Fairly sure the problem is androidx.appcompat version 1.1.0. Downgrading to 1.0.2 should solve the problem. https://stackoverflow.com/questions/41025200/android-view-inflateexception-error-inflating-class-android-webkit-webview

App devs can do this workaround:

implementation 'androidx.appcompat:appcompat:1.0.2'
implementation('com.pierfrancescosoffritti.androidyoutubeplayer:core:10.0.5') {
    exclude group: 'androidx.appcompat'
}

@cuongnb96
Copy link

@talklittle trust me,it not work so well.i tryed and still the same problem

@PierfrancescoSoffritti
Copy link
Owner

PierfrancescoSoffritti commented Nov 7, 2019

Yeah, I think @talklittle 's solution makes sense. Should solve the problem, at least for now.

@cuongnb96 you say you have pull request, what's your solution? (You don't need any permission to submit pull requests. Maybe you're trying to push directly on my branch?)

@cuongnb96
Copy link

@PierfrancescoSoffritti oh,i just tryed @talklittle way and it still crash on my device ( i guess it not always crash on 5. devices, just few one).Please preview this https://github.com/cuongnb96/android-youtube-player/commit/d7ba58db11c57e46418312fc87030fee14b6dc8f.i fork your lib and fix it ( i found this solution and it work on my device and other 5. device) and use that instead of Webview

@cuongnb96
Copy link

Yeah, I think @talklittle 's solution makes sense. Should solve the problem, at lest for now.

@cuongnb96 you say you have pull request, what's your solution? (You don't need any permission to submit pull requests. Maybe you're trying to push directly on my branch?)

i created a new branch and try to push it.but i cant.zzz.so pls check my comment above.it's the only way i can make it work on my device ( and all other )

@zjamshidi
Copy link

Updating the appcompat library solved the crash for me

implementation 'androidx.appcompat:appcompat:1.2.0-beta01'

@ahmedshahriar
Copy link

as of writing this comment, MAY 2020
Updating the appcompat library solved this crash as well as webview crash too

implementation 'androidx.appcompat:appcompat:1.3.0-alpha01'

@PierfrancescoSoffritti
Copy link
Owner

I 1.2.0 stable out? if yes no need to use 1.3.0-alpha

@ahmedshahriar
Copy link

Unfortunately current stable version 1.1.0

@ghost
Copy link

ghost commented Aug 20, 2020

1.2.0 stable available now.

@PierfrancescoSoffritti
Copy link
Owner

Does 1.2.0 stable solve the problem?

@lpbas
Copy link

lpbas commented Sep 22, 2020

We faced this crash today and I can confirm it stopped occurring when we updated to the stable implementation 'androidx.appcompat:appcompat:1.2.0' (at least in our case).

@abhishek-wiai
Copy link

It still crashes for stable 1.2.0 on API 21/ API 22

@PierfrancescoSoffritti
Copy link
Owner

Doesn't crash for me. Make sure that it's not crashing for other reasons.

farhan-arshad-dev added a commit to openedx/edx-app-android that referenced this issue Mar 8, 2021
- LEARNER-7267
- Update 'appcompat' library to '1.2.0'
Inspiration: PierfrancescoSoffritti/android-youtube-player#461 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants