- Instant App: RuntimeException: Unable to get provider FileProvider: SecurityException: Provider must grant uri permissions
- 2 Answers 2
- java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider #511
- Comments
- artuska commented Oct 8, 2018
- rankhispano commented Oct 11, 2018
- krcma96 commented Oct 12, 2018
- mattearly commented Oct 20, 2018
- ChrisCodes94 commented Oct 24, 2018
- ChrisCodes94 commented Oct 24, 2018 •
- phonetech2000 commented Oct 27, 2018
- ChrisCodes94 commented Oct 29, 2018
- adilthree commented Nov 13, 2018
- Redoyju commented Nov 23, 2018
- TruptiLondhe commented Dec 4, 2018
- saigor33 commented Sep 21, 2019
- Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException
- 15 Answers 15
- Unable to get provider com.google.firebase.provider.FirebaseInitProvider
- 20 Answers 20
- Unable to get provider : ClassNotFoundException
- 5 Answers 5
Instant App: RuntimeException: Unable to get provider FileProvider: SecurityException: Provider must grant uri permissions
I tried adding an instant app feature to my app, but when launching my app as an instant app I’m getting this error :
RuntimeException: Unable to get provider android.support.v4.content.FileProvider: java.lang.SecurityException: Provider must grant uri permissions
Here is how it’s used in my feature Manifest:
And my instant-app build.gradle :
What is wrong? Thanks for your help.
EDIT : Here is the complete logcat:
2 Answers 2
It looks like the FileProvider isn’t supported on O either because other apps aren’t allowed to see its ContentProvider .
I have a test app that works as an installed app but not as an instant app. It looks like instant apps aren’t allowed to use grantUriPermission (grant URI permissions) (which makes sense given the policy that instant apps can’t be visible to installed apps and ContentProvider is not visible).
This means that instant apps can’t retrieve pictures taken with ACTION_IMAGE_CAPTURE (because they can’t read external storage and the camera app can’t write to instant apps’ private storage).
Источник
java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider #511
Comments
artuska commented Oct 8, 2018
Why suddenly GMS started to appear in my Cordova Android build process and throws this error in Android Studio when i run an emulator?
The text was updated successfully, but these errors were encountered:
rankhispano commented Oct 11, 2018
krcma96 commented Oct 12, 2018
They have updated the AdMob SDK, you have to add your appID in the AndroidManifest
This fixed the crash but for some reason ads won’t load for me, please let me know if you experience the same issue.
mattearly commented Oct 20, 2018
hmm still not working for me.
ChrisCodes94 commented Oct 24, 2018
I have updated my scripts and till not working
ChrisCodes94 commented Oct 24, 2018 •
Working for me now
I changed my bannerID from the Ad mob test ID to my personal Banner ID, in both strings.xml and activity main
phonetech2000 commented Oct 27, 2018
hello i have a problem when i put code admob i have problem unfortunately my application android studio please how i can solve this problem
ChrisCodes94 commented Oct 29, 2018
hello i have a problem when i put code admob i have problem unfortunately my application android studio please how i can solve this problem
I don’t understand.
Please explain your problem better.
What error message is it giving you?
adilthree commented Nov 13, 2018
compile ‘com.google.android.gms:play-services-ads:12.0.0’
add this dependency your sdk is low for your dependency.
I faced this problem now i add this my problem solved
Redoyju commented Nov 23, 2018
TruptiLondhe commented Dec 4, 2018
compile ‘com.google.android.gms:play-services-ads:12.0.0’
add this dependency your sdk is low for your dependency.
I faced this problem now i add this my problem solved
its worked for my app
saigor33 commented Sep 21, 2019
Они обновили AdMob SDK, вы должны добавить свой appID в AndroidManifest
Это исправило сбой, но по какой-то причине объявления не будут загружаться для меня, пожалуйста, дайте мне знать, если вы испытываете ту же проблему.
Они обновили AdMob SDK, вы должны добавить свой appID в AndroidManifest
Это исправило сбой, но по какой-то причине объявления не будут загружаться для меня, пожалуйста, дайте мне знать, если вы испытываете ту же проблему.
Источник
Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException
I update my Android Studio (3.2.1) and its sdk to the latest version. After that it required a manual update for Manifest by adding these tags:
whereby instead the app ID I put the real id of my app. The value has also been changed to the right Ad Unit id as shown here https://developers.google.com/admob/android/quick-start. I also called this function in the MainActivity.kt:
However, the problem could not be solved. It still prints as follows:
Could someone tel me why it does happen or help me to solve it? I tried to google the issue, but there are no solutions. It seems to be an a new still unsolved issue. Many thanks in advance.
15 Answers 15
This happened due to updated AdMob SDK. Now you need to add appID in your manifest file.
You can get appID from here —>Google addmob —>Select app —> App Settings —> App ID.
You can read more from here ads-developers.
If you want to use test ads before putting your own id check the AdMob test ids from here developers.google.
Hope this will help you. Thanks 🙂
Google gave update for the Google ads so if you update your Admob library in gradle then you need to add this in your manifest.
Add In Your Manifest File
Don’t get confused with APPLICATION_ID. You should not replace it with your application ID for ex. com.example.myapp . Just keep it as it is.
Important: This step is required as of Google Mobile Ads SDK version 17.0.0. Failure to add this tag results in a crash with the message: The Google Mobile Ads SDK was initialized incorrectly.
Google Mobile Ads SDK v17.0.0 for Android has just been released, and it comes with these important changes.
Required AndroidManifest.xml changes
Starting in version 17.0.0, if you are an AdMob publisher you are now required to add your AdMob app ID in your AndroidManifest.xml file. Once you find your AdMob app ID in the AdMob UI, add it to your manifest adding the following tag:
Failure to add this tag will result in the app crashing at app launch with a message starting with The Google Mobile Ads SDK was initialized incorrectly.
What if I’m using Google Ad Manager instead of AdMob?
Publishers using Google Ad Manager will need to declare themselves as an Ad Manager app with a different tag to avoid the same crash:
Источник
Unable to get provider com.google.firebase.provider.FirebaseInitProvider
After going through the steps, the app launches and it crashes saying:
20 Answers 20
1.
Add the applicationId to the application’s build.gradle:
And than Clean Project -> Build or Rebuild Project
2. If your minSdkVersion
3.
If you use a custom Application class
I was with the same problem in devices with SDK MultiDex.install must be in the attachBaseContext method.
If you are using MultiDex, try this:
The accepted answer didn’t solve my problem.
If you are using Multidex, your Application should extends MultiDexApplication instead of Application .
MyApplication.java
AndroidManifest.xml
If you get the same problem but already have the applicationId set in build.gradle , you can also try the following:
- in Android Studio: Build > Clean Project
- in other IDEs: Clean, Rebuild, whatever.
I had the same problem in Pre Lollipop devices. To solve that I did as follows. Meantime I was using multiDex in the project.
1. add this for build.gradle in module: app
2. add this dependancy
3.Then in the MainApplication
4.In the manifests file
This works for me. Hope this Helps you too 🙂
you should be sure
to add this line at your manifest
Don’t include the whole play services library but use the one that you need.Replace the line in your build.gradle:
with the appropriate one from Google Play Services APIs,like for example:
Add this to your module-level build.gradle :
If you override Application class then extend it from MultiDexApplication :
If you cant extend it from MultiDexApplication class then override attachBaseContext() method as following :
And dont run anything before MultiDex.install(this) is executed.
If you dont override the Application class simply edit your manifest file as following :
This should works:
Step1:
Step 2:
Step 3: Take another class
Step 4: Add this line on manifest
In my case, the problem was solved by adding this line to the module build.gradle:
// ADD THIS AT THE BOTTOM
For react native app, the error was java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn’t find class «com.google.firebase.provider.FirebaseInitProvider» It was only getting for devices with Android Version Application in MainApplication.java with MultiDexApplication
NOTE: import android.support.multidex.MultiDexApplication;
In my case the problem happened after we migrated to AndroidX. For some reason, app was calling MultiDex.install() with reflection:
I changed package from android.support.multidex.MultiDex to androidx.multidex.MultiDex . It worked.
Instead of manually adding the package name on the build.gradle , you can do it this way:
first add this line at the beggining
Then add this on the defaultConfig
And finally add the doExtractStringFromManifest method
As there are a lot of Cordova comments on the answer, if you are working with Cordova, you shouldn’t really edit the build.gradle yourself, it has a comment at the beggining that say
So, if you are using a Cordova, the best thing you can do is to update to cordova-android 5.1.0 or greater where this changes are already present.
Источник
Unable to get provider : ClassNotFoundException
I have MyContentProvider in my app which works fine when I develop and run in debug mode.
But when I export the app, download it and run it, it crashes instantly :
I can reproduce it on all my devices, 2.2, 4.0, 4.1
I have read through numerous threads today. Some of them blaming ProGuard for this. I have tried adding
but with no luck.
When I disable proguard, by not putting proguard.config=proguard.cfg in my project.properties . It still gives the same error in release version. Debug is again fine. Maybe its not enough to disable proguard like that?
Maybe the hint is that it refers to maps.jar in this crash. Im not sure why it does that
Any clues will be much appreciated
5 Answers 5
Argh, thought I tried that, but seems like I didnt.
Project -> clean made it work
I was getting the same error, turns out I had the wrong android:name attribute value for my provider tag in AndroidManifest.xml:
So double check this value is as above .ProviderClass or whatever your class name is (prefixed with a dot). Then do Project > Clean and it will work.
The authorities attribute needs to match the content authority while the name attribute needs to match the class name of your Custom Provider class.
Maybe my inexperience will help someone else with this bug. It was utterly cryptic to me, but like everything in computers obvious once you know.
Early on, he says to create a package called «contentprovider» and then a class within it «MyTodoContentProvider». Now anyone familiar with Java-style naming conventions would have seen this was supposed to be relative to the main package. But I was new to this all, so I created it over on the side somewhere.
All through building the code, things worked fine. Eclipse found and included this package, and showed no errors. Then the crash and the cryptic «Unable to get provider» message. The path in the error message, which I now understand was the non-existent path where the code was looking for the class, was so long and contained so many iterations of «contentprovider» it was hard to see what it was referring to or what was wrong with it.
I suspected the problem was in the manifest file, but I was sure it was in «android:authority». That was a bit non-intuitive. The string in this element in the manifest corresponds to a public member you expose in your provider class. That member is named «CONTENT_URI». But the two do not exactly match. For example:
This ends up with:
(Note that AUTHORITY itself is a private member, not externally available.)
The corresponding manifest line would be:
This is the middle part between the scheme «content://» and the base path.
The problem was actually in the manifest line:
I had an error-free class named «MyTodoContentProvider» in a package named «contentprovider», so what was the problem? The problem was that the package was in the wrong place. It was supposed to be relative to the main package. That’s what the dot, first in the name, means. It should follow the same syntax as the «android:name» lines of the activities, in their sections of the manifest.
If you find this useful, please one-up. Once you solve this problem, it’s easy to forget how cryptic it was.
Источник