We released a beta of our product, it works for most users, but one user with OnePlus 5T/Android 8.1 reports a sporadic exception:
java.lang.RuntimeException: Unable to resume activity {com.ourproduct/com.ourproduct.MainActivity}: java.lang.IllegalArgumentException: Unknown URL content://com.ourproduct.data/delete
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3726)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3766)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1737)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6753)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:482)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by:java.lang.IllegalArgumentException: Unknown URL content://com.ourproduct.data/delete
at android.content.ContentResolver.delete(ContentResolver.java:1745)
<... here is our code stacktrace ...>
I contacted the user and got some additional info: the issue does not happen every time he uses the operation, just sometimes.
The content provider is defined in the same application.
The code is trivial, just for completeness of the question:
protected void unsetValue(final String group, final String name) {
myContext.getContentResolver().delete(
uri("delete"), null, new String[] { group, name }
);
}
private Uri uri(String location) {
return Uri.parse("content://com.ourproduct.data/" + location);
}
Any ideas? Maybe I can ask the user for some additional info?
Related
I am using JItsi meet api for video call on linphone android app open source project. I have followed jitsi meet handbook for integrating on linphone.
Here is my sample code:
public class JitsiActivity extends AppCompatActivity {
#Override
protected void onCreate(#Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
URL serverURL;
try {
serverURL = new URL("https://meet.jit.si");
} catch (MalformedURLException e) {
e.printStackTrace();
throw new RuntimeException("Invalid server URL!");
}
JitsiMeetConferenceOptions defaultOptions =
new JitsiMeetConferenceOptions.Builder()
.setServerURL(serverURL)
.setWelcomePageEnabled(false)
.build();
JitsiMeet.setDefaultConferenceOptions(defaultOptions);
JitsiMeetConferenceOptions options =
new JitsiMeetConferenceOptions.Builder().setRoom("linphone").build();
JitsiMeetActivity.launch(this, options);
finish();
}
}
I have successfully made a call on debug mode, after making an apk on release mode, It refresh activity when I attempt to make a video call and go to home page. can you give me a guideline to solve this problem. I have tested apk on Android 10 OS.
--After Debugging on release mode I have found this error
020-09-24 16:50:12.383 10364-10364/org.linphone E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.linphone, PID: 10364
java.lang.IllegalArgumentException: reportSizeConfigurations: ActivityRecord not found for: Token{2329006 ActivityRecord{cf5fae1 u0 org.linphone/.activities.JitsiActivity d-1 s-1 t-1 f}}
at android.os.Parcel.createException(Parcel.java:1967)
at android.os.Parcel.readException(Parcel.java:1931)
at android.os.Parcel.readException(Parcel.java:1881)
at android.app.IActivityManager$Stub$Proxy.reportSizeConfigurations(IActivityManager.java:8621)
at android.app.ActivityThread.reportSizeConfigurations(ActivityThread.java:3360)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3318)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:113)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:71)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2043)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7096)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:536)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:928)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.am.ActivityManagerService.reportSizeConfigurations(ActivityManagerService.java:10305)
at android.app.IActivityManager$Stub.onTransact$reportSizeConfigurations$(IActivityManager.java:12560)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2357)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3841)
at android.os.Binder.execTransact(Binder.java:750)
You need to provide a stacktrace to for anyone to help you debug it, however, this code can be simplified greatly which would lead to easier debugging..
You are supplying Jitsi with it's own default server url "https://meet.jit.si" which isn't necessary as Jitsi will use it's own server anyway. If you were planning on using your own server you can still provide that easily in the JitsiMeetActivity::launch method as the room parameter...
JitsiMeetActivity.launch(context, "https://myserver.com/linphone")
Removing all the unnecessary boiler-plate will leave you with this:
#Override
protected void onCreate(#Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
JitsiMeetActivity.launch(this, "linphone");
}
On the app launch, I need to check whether a new version is available on play store or not. To check I have implemented below code in Splash screen.
private void checkNewVersionAvailability() {
appUpdateManager = AppUpdateManagerFactory.create(getApplicationContext());
appUpdateInfo = appUpdateManager.getAppUpdateInfo();
appUpdateInfo.addOnCompleteListener(new OnCompleteListener<AppUpdateInfo>() {
#Override
public void onComplete(Task<AppUpdateInfo> task) {
if (task.isComplete()) {
if (task.getResult().updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE) {
checkVersion(task.getResult());
} else if (task.getResult().updateAvailability() == UpdateAvailability.UPDATE_NOT_AVAILABLE) {
if (StringUtils.isNullOrEmpty(ChevronApplication.deviceId)) {
new Handler().postDelayed(new Runnable() {
#Override
public void run() {
RegsiterDeviceHandler handler = new RegsiterDeviceHandler(SplashScreen.this);
handler.registerDevice(false);
handler.showNextScreen();
}
}, SLEEP_TIME);
} else {
new Handler().postDelayed(new Runnable() {
#Override
public void run() {
new RegsiterDeviceHandler(SplashScreen.this).showNextScreen();
}
}, SLEEP_TIME);
}
}
}
}
});
During testing on the device, I didn't get the issue. These crash logs are I found from the Pre-launch report in Playstore.
> FATAL EXCEPTION: main
Process: com.mac.app, PID: 19641
com.google.android.play.core.tasks.RuntimeExecutionException: com.google.android.play.core.internal.aa: Failed to bind to the service.
at com.google.android.play.core.tasks.k.getResult(Unknown Source)
at com.chevronrenaissance.app.activity.SplashScreen$2.onComplete(SplashScreen.java:113)
at com.google.android.play.core.tasks.a.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5538)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: com.google.android.play.core.internal.aa: Failed to bind to the service.
at com.google.android.play.core.internal.q.b(Unknown Source)
at com.google.android.play.core.internal.q.a(Unknown Source)
at com.google.android.play.core.internal.s.a(Unknown Source)
at com.google.android.play.core.internal.r.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
There seems to be an issue with Google Play Core library with Android Virtual Devices. I had to add a try/catch statement so the Pre-launch testing passes. I think you may have to wrap al your AppUpdateManager calls so the exception is catched.
I was running a very similar issue using the in-app review component. It turned out one of the emulators I was developing with had not been signed into a Google Play account. You may want to ensure your emulator is signed into Google Play.
You can check task.isSuccessful().
In this case, when the task is not successful, you can get the exception use method task.getException()
Most likely that the Emulator you are using do not contain Google Play at all.
If you are running it in a emulator and if emulator is not signed for Google play, it will show the error that "PID: [6084] AppUpdateService : Failed to bind to the service."
I am developer of a password manager app which provides an Android Autofill service (Android 8+).
Some users requested that it should be possible to disable this service on a per-target-app basis. In the autofill service's onFillRequest I am adding a "dataset" with "Disable autofill for [package name]" like this:
var sender = IntentBuilder.GetDisableIntentSenderForResponse(this, query, isManual, isForDisable);
RemoteViews presentation = AutofillHelper.NewRemoteViews(PackageName,
GetString(Resource.String.autofill_disable , new Java.Lang.Object[] { query}), Resource.Drawable.ic_menu_close_grey);
var datasetBuilder = new Dataset.Builder(presentation);
datasetBuilder.SetAuthentication(sender);
foreach (var autofillId in autofillIds)
{
datasetBuilder.SetValue(autofillId, AutofillValue.ForText("PLACEHOLDER"));
}
responseBuilder.AddDataset(datasetBuilder.Build());
When the user clicks the "Disable dataset", an activity is launched which stores the package for which Autofill should be disabled and then immediately finishes itself.
My question: what should I return as a reply from that activity to indicate that Autofill should be invisible from now on?
I am currently doing
bool isManual = Intent.GetBooleanExtra(ChooseForAutofillActivityBase.ExtraIsManualRequest, false);
Intent reply = new Intent();
FillResponse.Builder builder = new FillResponse.Builder();
AssistStructure structure = (AssistStructure)Intent.GetParcelableExtra(AutofillManager.ExtraAssistStructure);
StructureParser parser = new StructureParser(this, structure);
try
{
parser.ParseForFill(isManual);
}
catch (Java.Lang.SecurityException e)
{
Log.Warn(CommonUtil.Tag, "Security exception handling request");
SetResult(Result.Canceled);
return;
}
AutofillFieldMetadataCollection autofillFields = parser.AutofillFields;
var autofillIds = autofillFields.GetAutofillIds();
builder.SetIgnoredIds(autofillIds);
Bundle state = new Bundle();
state.PutStringArray("AutoFillDisabledQueries", disabledValues.ToArray());
builder.SetClientState(state);
try
{
var response = builder.Build();
reply.PutExtra(AutofillManager.ExtraAuthenticationResult, response);
}
catch (Exception e)
{
Kp2aLog.LogUnexpectedError(e);
throw;
}
SetResult(Result.Ok, reply);
But
1.) The prompt for autofill does not disappear
2.) if I click disable again, the target app is force-closed (see end of message for details)
so that's obviously not the way to go... Any ideas? Thanks a lot!
Regarding point 2 above, I see the following in logcat:
12-17 09:48:31.865 Google Pixel Error 11711 AndroidRuntime java.lang.RuntimeException: Failure delivering result ResultInfo{who=#android:autoFillAuth:, request=16121857, result=-1, data=Intent { (has extras) }} to activity {com.sonelli.juicessh/com.sonelli.juicessh.activities.ManageConnectionActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.List.get(int)' on a null object reference
at android.app.ActivityThread.deliverResults(ActivityThread.java:4361)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4403)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1809)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6680)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
setIgnoredIds() should be used for fields that are not autofillable (for example, if the screen had an username, password, and captcha fields, you could use to ignore the latter).
If you want to disable autofill for the activity, you need to return a Fillresponse with just the [disableAutofill()][1] set on it. Notice that disabling it doesn't persist after reboots, so you should keep track of it internally, and call that API if the activity triggers autofill again.
I am using cast feature in my application. It was working fine but suddenly I can see the increase in the number of crashes on play store console.
I am initializing CastContext properly as defined in the guidelines and Moreover, I am checking that device is compatible or not before calling this method CastContext.getSharedInstance(context) So that should not be an issue.
I am not able to reproduce this crash even on emulators with or without google-play-services one.
Any help will be appreciated.
Crash :
Fatal Exception: java.lang.RuntimeException: Unable to start activity
ComponentInfo{... .activity.TVActivityPhone}:
java.lang.RuntimeException: com.google.android.gms.dynamite.DynamiteModule$zza: Remote load
failed. No local fallback found. at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2677)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2747)
at android.app.ActivityThread.access$900(ActivityThread.java:187) at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1584)
at android.os.Handler.dispatchMessage(Handler.java:111) at
android.os.Looper.loop(Looper.java:194) at
android.app.ActivityThread.main(ActivityThread.java:5877) at
java.lang.reflect.Method.invoke(Method.java) at
java.lang.reflect.Method.invoke(Method.java:372) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815) Caused
by java.lang.RuntimeException:
com.google.android.gms.dynamite.DynamiteModule$zza: Remote load
failed. No local fallback found.
Code I am getting an error inside the if the condition that means, it's not about the google play service availability.
if (googlePlayServicesVerified(context)) { // checking (result==ConnectionResult.SUCCES)
Log.d("TAG", "instantiated");
castContext = CastContext.getSharedInstance(context);
} else {
Log.e(TAG, "FAILED");
}
Filed bug to google:
https://issuetracker.google.com/issues/65359941
** Update **
Check these two issues :
https://issuetracker.google.com/issues/65359941
https://issuetracker.google.com/issues/79405933
The temporary solution is in my answer.
This is the temporary solution.
1) Your app should always check GPS version before using any Cast APIs
2) Allow CastContext.getSharedInstance() to fail. Probably throw/catch an exception (or alternatively return null).
3) Make sure, you don't break anything if the dynamite module fails to load. There are some UI widgets that are initialized implicitly which calls CastContext.getSharedInstance(), such as MiniControllerFragment. You should avoid letting it crash if dynamite fails to load.
public static boolean isAvailable(Context context)
{
GoogleApiAvailability availability = GoogleApiAvailability.getInstance();
return isGooglePlayServicesAvailable(context, availability) &&
isCastContextAvailable(context);
}
public static boolean isAvailable(Context context) {
if (googlePlayServicesVerified(context)) {
try {
castContext = CastContext.getSharedInstance(context);
Log.d(TAG, "CastContext instantiated");
} catch (Exception e) {
Log.report(e);
castContext = null;
}
} else {
CrashReporter.report("CastContext FAILED to be instantiated : googlePlayServicesVerified() has failed."));
castContext = null;
}
}
I get this issue when play services are out of date (mainly on emulators running API 24). This worked for me:
GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
int resultCode = googleApiAvailability.isGooglePlayServicesAvailable(this);
if (resultCode == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED) {
googleApiAvailability.getErrorDialog(this, resultCode, 1000).show();
return;
}
startApp();
I run this code in an Activity which checks if MainActivity should be started
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I need to send binary content from my app to whatever app opens that file type in the device.
I'm following these instructions:
https://developer.android.com/training/sharing/send.html#send-binary-content
Here's my code:
final FileType fileType
final File file;
final Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(AncestryApplication.getAppContext(), AncestryApplication.getAppContext().getApplicationContext().getPackageName() + ".provider", file));
intent.setType(fileType.getMimeType());
startActivity(intent);
A few things:
If I change the intent action from ACTION_VIEW to ACTION_SEND, I get the wrong possible list of apps to open my file
ACTION_SEND seems to work, but only with small file sizes
intent.setDataAndType() seems to work fine on devices OS M and lower. On N I get the same TransactionTooLargeException
At the end, this is what I need to accomplish:
I already have a file saved, and it is stored at file:///storage/emulated/0/Download/TempFile.html
Since the file may be too large, I need to send just the location of the file to a third party app (like adobe pdf reader) to open the file
No issues on M or lower, tons of issues on N
Any ideas on what I may be doing wrong? I've been trying to solve this for a few days and I've read a ton of tutorials and SO suggestions, without any final answer.
Thanks.
EDIT: here's my stacktrace:
AndroidRuntime: FATAL EXCEPTION: main
Process: com.myapp.android.apps.myapp, PID: 26785
java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 27943540 bytes
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3752)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: android.os.TransactionTooLargeException: data parcel size 27943540 bytes
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:615)
at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:3606)
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3744)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
EDIT 2: Added onSaveInstanceState() code from base fragment:
#Override
public void onSaveInstanceState(final Bundle outState) {
mSaveInstanceStateCalled = true;
outState.putBoolean(KEY_PROCESSING_SAVE, mSaveInProgress);
}
The exception in the logcat you posted is caused by packing too much data into the Bundle processed by onSaveInstanceState.
Here is the method from the Android source where it is thrown, if the build version is N or greater:
private static class StopInfo implements Runnable {
ActivityClientRecord activity;
Bundle state;
PersistableBundle persistentState;
CharSequence description;
#Override public void run() {
// Tell activity manager we have been stopped.
try {
if (DEBUG_MEMORY_TRIM) Slog.v(TAG, "Reporting activity stopped: " + activity);
ActivityManagerNative.getDefault().activityStopped(
activity.token, state, persistentState, description);
} catch (RemoteException ex) {
if (ex instanceof TransactionTooLargeException
&& activity.packageInfo.getTargetSdkVersion() < Build.VERSION_CODES.N) {
Log.e(TAG, "App sent too much data in instance state, so it was ignored", ex);
return;
}
throw ex.rethrowFromSystemServer(); // <<-- exception thrown here
}
}
}
I am posting this in the form of an answer because it's too long for a comment. It is not meant as a complete answer to the question, because there is not enough information in the question to answer it.