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.
Related
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>
I am trying to use Parse in my Unity game in order to implement high scores. My problem is that when I try to put the game on my android device to test it, the name of the app comes up different. It comes up as "ParseUnityPushSample" even though I have not changed anything besides adding the files that Parse gives me to use it. The build settings have not changed and it even shows that my package name is the same, yet testing it on a device has this result.
Testing it in Unity 5 works fine. The game loads as it should. This only happens when I try to put it on a device for testing.
Along with it changing the app name, it also crashes when opening. I get a prompt that says "ParseUnityPushSample" has failed anytime I try to open it on an android device.
EDIT:
Okay so I figured out a way to view some errors that occur when testing on a device. I get this error: "Unable to find unity activity in manifest. You need to make sure orientation attribute is set to sensorLandscape manually.
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()" I have no idea what the issue is though since I have manually set the orientation for the activity to sensorLandscape in the Android Manifest.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.laserdeflector.sab" android:versionName="1.0.1" android:versionCode="1" android:installLocation="preferExternal">
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:protectionLevel="signature" android:name="com.laserdeflector.sab.permission.C2D_MESSAGE" />
<uses-permission android:name="com.laserdeflector.sab.permission.C2D_MESSAGE" />
<uses-permission android:name="com.android.vending.BILLING" />
<application android:label="Laser Deflector" android:icon="#drawable/app_icon" android:screenOrientation="sensorLandscape" android:name="com.soomla.SoomlaApp" android:debuggable="false" android:isGame="true">
<activity android:name=".UnityPlayerActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name="com.parse.ParsePushBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.laserdeflector.sab" />
</intent-filter>
</receiver>
<service android:name="com.parse.ParsePushService" />
<activity android:name="com.soomla.store.billing.google.GooglePlayIabService$IabActivity" android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<meta-data android:name="billing.service" android:value="google.GooglePlayIabService" />
</application>
<uses-feature android:glEsVersion="0x00020000" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
</manifest>
8/10/15
I have come to learn that this may be an issue with Parse v1.5.2 although changing to v1.3.2 did not help with the issue I am facing either. I will update as soon as I learn anything more.
8/11/15
Updating to v1.5.4 did not fix the issue either. Still having problems with the android manifest with the same error message. If anyone has any idea please let me know!
In my case, just taking the Unity sdk was not the answer. In order to make it work I had to use what was in the Unity blank project and then I also deleted the android manifest that v1.5.2 included in the sdk. Doing both of these things allowed the app to work correctly on my android device.
Problem is in your manifest file, you have changed the following lines
<receiver android:name="com.parse.ParsePushBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<service android:name="com.parse.ParsePushService" />
to this
<receiver android:name="com.laserdeflector.PushBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<service android:name="com.laserdeflector.ParsePushService" />
Here is the correct manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.laserdeflector.sab"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:protectionLevel="signature" android:name="com.laserdeflector.sab.permission.C2D_MESSAGE" />
<uses-permission android:name="com.laserdeflector.sab.permission.C2D_MESSAGE" />
<application android:label="LaserDeflector" android:icon="#drawable/app_icon">
<activity android:name=".UnityPlayerActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name="com.parse.ParsePushBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.laserdeflector.sab" />
</intent-filter>
</receiver>
<service android:name="com.parse.ParsePushService" />
</application>
</manifest>