I work on an android app in Visual Studio.
When I implement a simple banner, the banner in this app says:
"Missing AdActivity with android:configChanges in AndroidManifest.xml."
I looked this issue up and many people had this problem but it always was in Android Studio. Can you help me out? I think it might have something to do with my manifest - which looks like that:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.TalkAboutTv2.TalkAboutTv2" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
<uses-sdk android:minSdkVersion="16" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:label="Talk About Tv"></application>
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:theme="#android:style/Theme.Translucent" />
</manifest>
THanks :)
You should make some changes to your code:
1) <activity> must be a child of the <application>
2) Add this
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version"/>
to the <application> too.
This should result in the following code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.TalkAboutTv2.TalkAboutTv2" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
<uses-sdk android:minSdkVersion="16" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:label="Talk About Tv">
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version"/>
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:theme="#android:style/Theme.Translucent" />
</application>
</manifest>
Related
This is the error
> am start -a "android.intent.action.MAIN" -c "android.intent.category.LAUNCHER" -n "PictureApp.jiahong/crc64ad68f59cd763e462.PictureApp"
> Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=PictureApp.jiahong/crc64ad68f59cd763e462.PictureApp }
Error type 3
Error: Activity class {PictureApp.jiahong/crc64ad68f59cd763e462.PictureApp} does not exist.
Failed to launch android application
Not sure what's wrong with it. I've tried everything on all the SO answers, and it still doesn't work.
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="PictureApp.jiahong" android:installLocation="auto">
<uses-sdk android:minSdkVersion="22" android:targetSdkVersion="29" />
<application android:usesCleartextTraffic="true" android:label="App1" android:theme="#style/MainTheme" android:icon="#mipmap/icon">
<provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="#xml/file_paths"></meta-data>
</provider>
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.LOCATION_HARDWARE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />
<uses-feature android:name="android.hardware.location.gps" android:required="true" />
</manifest>
I've changed most things where I can to PictureApp instead of App1 but still nothing. I don't know what else I can provide. So if I'm missing something comment it and I'll add it. I am completely lost and I have no idea what to do.
I had about 20 instances of the same app installed in the PrivateSpace of my same device. Had to delete all instances for it to properly work. As suggested in this Github comment.
I am trying to install an APK from my Xamarin.Forms application.
I've created a DependencyService in Android implementation using FileProvider with this piece of code:
Java.IO.File file = new Java.IO.File(updtFile);
var realUri = Android.Support.V4.Content.FileProvider.GetUriForFile(MainActivity.Instance, MainActivity.Instance.PackageName + ".provider", file);
Intent install = new Intent(Intent.ActionInstallPackage);
install.AddFlags(ActivityFlags.GrantReadUriPermission);
install.AddFlags(ActivityFlags.GrantWriteUriPermission);
install.AddFlags(ActivityFlags.GrantPersistableUriPermission);
install.SetDataAndType(realUri, "application/vnd.android.package-archive");
MainActivity.Instance.StartActivity(install);
It works flawlessly with Android 7, opening the package manager as expected.
It does absolutely nothing with Android 8.1, not even throwing an exception or so. I have all permission enabled for the app and if I try to open the APK with file explorer it works without any problem.
This is my Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0.1.0" package="..." android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
<application android:label="..." android:icon="#drawable/icon">
<provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="#xml/provider_paths" />
</provider>
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
</manifest>
And this is provider_paths.xml
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="." />
</paths>
Am I missing something?
Thanks.
Found it! I was missing this permission in Manifest:
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
The error i am getting is as follows
System.ArgumentException: 'Unable to get file location. This most likely means that the file provider information is not set in your Android Manifest file.
I have gone through all the suggestions i can find regarding permissions for fileprovider to no avail
The code where it is failing is..
var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
{
Directory = "",
SaveToAlbum = true
});
(I have tried setting "Directory" to "images", "pictures" and just about anything else you can think of !
resources/file_paths.xml is...
<?xml version="1.0" encoding="utf-8" ?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-files-path name="my_images" path="Pictures" />
<external-files-path name="my_movies" path="Movies" />
</paths>
My AndroidManifest .xml is ...
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.app1" android:installLocation="auto">
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="28" />
<application android:label="App1.Android" android:icon="#drawable/Woodstonelogo"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application android:label="App1.Android">
<provider android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="#xml/file_paths"></meta-data>
</provider>
</application>
</manifest>
Cause :
In your AndroidManifest.xml you define two application tags . So the first one will work in default . So the provider will never been set as it's in the second tag .
Solution:
Modify the code like following
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.app1" android:installLocation="auto">
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="28" />
<application android:label="App1.Android" android:icon="#drawable/Woodstonelogo">
<provider android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="#xml/file_paths"></meta-data>
</provider>
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>
MainActivity.cs:
Java.IO.File file = new Java.IO.File(filePath);
Android.Net.Uri uri = FileProvider.GetUriForFile(this, "com.companyname.quickexam_final.FileProvider", file);
Intent intent = new Intent(Intent.ActionView);
intent.SetDataAndType(uri, "application/pdf");
intent.SetFlags(ActivityFlags.ClearWhenTaskReset | ActivityFlags.NewTask);
this.StartActivity(intent);
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.quickexam_final" android:installLocation="auto">
<uses-sdk android:minSdkVersion="20" android:targetSdkVersion="28" />
<application android:allowBackup="true" android:label="#string/app_name" android:roundIcon="#mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="#style/AppTheme" android:icon="#mipmap/ic_launcher">
<provider android:name="android.support.v4.content.FileProvider" android:authorities="com.companyname.quickexam_final.FileProvider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="#xml/provider_paths" />
</provider>
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
provider_paths.xml
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="."/>
</paths>
Then, when I start my app I see a Toast
"We don't have access to open this file."
How can I solve this problem?
I would guess that this is because for persmissions that are regarded as dangerous, you need to explicitly request them. It is not enough just to have them in the manifest. To solve it you should use ActivityCompat.RequestPermissions to explicitly request access to these.
If you check the spec here it lists, for example, "READ_EXTERNAL_STORAGE" as a dangerous permission requiring an explicit prompt.
https://developer.android.com/reference/android/Manifest.permission#READ_EXTERNAL_STORAGE
You can see here more about this issue:
https://developer.android.com/guide/topics/permissions/overview#dangerous-permission-prompt
I have a problem implementing AdMob in my Xamarin.Forms project.
So when I run the android app this is shown in the output:
01-22 16:53:17.351 W/Ads (3529): Missing AdActivity with android:configChanges in AndroidManifest.xml.
You must have the following declaration within the <application> element:
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
But my Manifest got this line in it..:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto">
<uses-sdk android:minSdkVersion="15" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
And when I open the page containing the ad this is showing:
What is wrong here ?
<activity> tag should be inside the <application> tag
<application>
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>