自上周以来,由于一些 admob 错误,我在生产版本的应用程序中遇到了致命错误
Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'com.google.android.gms.ads.internal.overlay.n com.google.android.gms.ads.internal.overlay.AdOverlayInfoParcel.c' on a null object reference
at com.google.android.gms.ads.internal.overlay.k.f(k.java)
at com.google.android.gms.ads.internal.overlay.client.b.a(b.java:1)
at fy.onTransact(fy.java:4)
at android.os.Binder.transact(Binder.java:662)
at com.google.android.gms.internal.ads.zzgu.zzb(zzgu.java:21)
at com.google.android.gms.internal.ads.zzarl.onUserLeaveHint(zzarl.java:54)
at com.google.android.gms.ads.AdActivity.onUserLeaveHint(AdActivity.java:32)
at android.app.Activity.performUserLeaving(Activity.java:7470)
at android.app.Instrumentation.callActivityOnUserLeaving(Instrumentation.java:1476)
at android.app.ActivityThread.performUserLeavingActivity(ActivityThread.java:4034)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:4016)
at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1839)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6864)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Run Code Online (Sandbox Code Playgroud)
我无法在测试中重现该问题。但正如堆栈显示的那样,它是由于响应 android 本机事件的 admob api 的一些内部调用引起的。
我正在使用的版本:
'com.google.gms:google-services:4.3.4'
api "com.google.android.gms:play-services-location:17.1.0"
api 'com.google.android.gms:play-services-ads:19.5.0'
Run Code Online (Sandbox Code Playgroud) 我的应用程序有大约 20k 每日活跃用户,并且发生了一次致命崩溃,仅影响 Android 11 用户,我无法确定根本原因。
堆栈跟踪是
Fatal Exception: android.app.RemoteServiceException: Attempt to invoke virtual method 'int com.android.server.wm.TaskDisplayArea.getDisplayId()' on a null object reference
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2054)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:250)
at android.app.ActivityThread.main(ActivityThread.java:7755)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
Run Code Online (Sandbox Code Playgroud)
100% 受影响的用户是 android 11 摩托罗拉设备 [3 种不同的摩托罗拉型号],并且 100% 的应用程序在后台运行
堆栈跟踪显示这与在屏幕上显示图像有关,但错误发生在许多不同的情况下,我知道[我的]通用代码可能是原因
有人面临这个问题吗?
是否有任何已知的摩托罗拉相关问题可能是原因?
有什么方法可以更好地调试它并找出根本原因吗?
我正在尝试使用 Google Play 应用内计费来实现支付处理器的后端。
Google Play 计费 API 完全是为无服务场景构建的,并且要使其适用于正常的世界情况(应用程序具有需要验证和处理支付逻辑的后端)是一项艰巨的工作。
我正在关注本教程:https://developer.android.com/google/play/billing/getting-ready#configure-rtdn
但只有在实现整个逻辑之后我才读到那条小线
实时开发者通知 (RTDN) 是一种每当应用中用户的权利发生变化时接收来自 Google 的通知的机制。RTDN 利用 Google Cloud Pub/Sub,它允许您接收推送到您设置的 URL 或使用客户端库轮询的数据。这些通知使您可以立即对订阅状态更改做出反应 ,而无需轮询 Google Play 开发者 API。请注意,Google Play Developer API 使用效率低下可能会导致 API 配额限制。
所以我的逻辑集成做得很好,Play控制台中的测试消息有效,但Google Play计费没有发送真正的通知,因为我的应用程序处理应用程序内产品而不是订阅
然后我读了这个教程https://developer.android.com/google/play/billing/rtdn-reference它说
注意:仅针对某些类型的一次性购买发送 OneTimePurchaseNotification。有关详细信息,请参阅集成。
但链接是: https: //developer.android.com/google/play/integrate转到 404
有谁知道如何让 Google Play 控制台发送有关应用内购买的付款状态的通知?
以及如何获取退款购买的通知
android in-app-billing firebase google-cloud-pubsub google-cloud-functions
这是一个很长的故事,我会尽量提供尽可能多的细节。
几个月来,我一直在使用 android studio 3.xx 来构建我的应用程序,直到最近它开始为我提供最新的稳定版 4.0.1 的更新。
我更新了,它应该是无忧无虑的,所有插件都更新没有错误,代码首先在新的 android studio 中编译,该项目在测试中运行良好,然后我上传到 Play 商店的内部测试轨道(这里是问题开始)。
该应用程序开始在某些设备中显示某种锁定或无限循环错误......这很奇怪,因为运行调试版本时完全相同的设备很好,此时我认为有些proguard rules是问题所在。所以我调整了build.grade文件,以使debug构建具有与构建相同的设置release(缩小和缩小 TRUE)。
编译后,应用程序在模拟器和有问题的设备中顺利运行......
我再次将其上传到谷歌播放,并从那里下载该应用程序不起作用......
我做了一个非常详尽和烦人的代码调试,以获取以某种方式被锁定的方法,我发现了这个嫌疑人:
OkHttpClient.Builder httpClientBuilder = new OkHttpClient.Builder();
httpClientBuilder.readTimeout(15000, TimeUnit.MILLISECONDS);
httpClientBuilder.writeTimeout(15000, TimeUnit.MILLISECONDS);
httpClientBuilder.connectTimeout(15000, TimeUnit.MILLISECONDS);
httpClientBuilder.retryOnConnectionFailure(true);
httpClientBuilder.followRedirects(true);
httpClientBuilder.followSslRedirects(true);
httpClientBuilder.connectionPool(DEFAULT_CONNECTION_POOL);
Dispatcher dispatcher = new Dispatcher();
dispatcher.setMaxRequests(10);
dispatcher.setMaxRequestsPerHost(10);
httpClientBuilder.dispatcher(dispatcher);
okHttpClient = httpClientBuilder.build();
private boolean isInternetOK(){
boolean ret = false;
try {
okHttpClient.newCall(new Request.Builder().get().url("https://www.google.com").build()).execute();
ret true;
} catch (Exception e) {
}
return ret;
}
Run Code Online (Sandbox Code Playgroud)
在我的启动器活动中,在开始登录之前,我验证用户的 Internet 连接是否正常,这是一个简单的代码,并且httpclient …
我面临着一个非常烦人的 Android 崩溃,该崩溃发生在大约 1% 的生产会话中,并且应用程序始终在后台运行。
Fatal Exception: android.app.RemoteServiceException: Attempt to invoke virtual method 'int com.android.server.wm.TaskDisplayArea.getDisplayId()' on a null object reference
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2054)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:250)
at android.app.ActivityThread.main(ActivityThread.java:7755)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
Run Code Online (Sandbox Code Playgroud)
从这个堆栈可以清楚地看出,它来自内部 android MainLooper 操作...但是缺乏额外的信息,我很难发现到底是什么
有谁知道这是什么问题以及如何解决它?
我正在尝试为我的视频播放器制作一个微调吧
trimmer_bar.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/thumbsBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
tools:background="@color/trimmerBarSelected">
<ImageView
android:id="@+id/leftThumb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription=""
android:scaleType="fitStart"
android:src="@drawable/ic_left_thumb" />
<ImageView
android:id="@+id/rightThumb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:contentDescription=""
android:scaleType="fitEnd"
android:src="@drawable/ic_right_thumb" />
</RelativeLayout>
<ImageView
android:id="@+id/progressIndicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="60dp"
android:layout_marginTop="3dp"
android:contentDescription=""
android:scaleType="centerCrop"
android:src="@android:drawable/btn_star_big_on" />
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
activity_video_viewer:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#a8c71c"
tools:context=".activities.VideoTrimmerActivity">
<com.tomatedigital.instagram.longstories.ui.TrimmerBar
android:id="@+id/trimmerBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/trimmerBarSelected"
/>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
它的逻辑运作得很好:当用户触摸时,我检测到它是否在左拇指上的任何拇指和外壳上我调整了thumbBar的左边距,右边的情况我调整右边距...
由于两个imageview与边缘对齐,这种行为使它们移动......但实际上移动的是整个RelativeLayout
问题是甚至调整边距并移动图像视图,相对布局仍然显示边缘区域中的背景
忽略整个计算我使用以下方法设置边距:
this.thumbsBar= (RelativeLayout) findViewById(R.id.thumbsBar);
this.thumbsBarLayout = (LayoutParams) …Run Code Online (Sandbox Code Playgroud) 我更新了
implementation 'com.android.installreferrer:installreferrer:X'
Run Code Online (Sandbox Code Playgroud)
从1.1.2到2.0
然后开始收到此错误:
Process: com.tomatedigital.lottogram, PID: 13424
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/aidl/BaseStub;
at com.android.installreferrer.api.InstallReferrerClientImpl.startConnection(InstallReferrerClientImpl.java:36)
at com.tomatedigital.lottogram.app.App.saveReferralInfo(App.java:221)
at com.tomatedigital.lottogram.app.App.onCreate(App.java:102)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1182)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6460)
at android.app.ActivityThread.access$1300(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Run Code Online (Sandbox Code Playgroud)
代码没有从上一个版本改变(工作正常)
final InstallReferrerClient mReferrerClient = InstallReferrerClient.newBuilder(this).build();
try {
mReferrerClient.startConnection(new InstallReferrerStateListener() {
public void onInstallReferrerSetupFinished(int responseCode) {
//do stuff
}
@Override
public void onInstallReferrerServiceDisconnected() {
}
});
} catch (Exception e) {
FirebaseCrashlytics.getInstance().recordException(e);
}
}
Run Code Online (Sandbox Code Playgroud)
我正在使用 android …
我正在尝试使用Gson将一个非常基本的对象序列化为JSON.
这是班级
@org.greenrobot.greendao.annotation.Entity
public class Giveaway {
@Id(autoincrement = true)
@Expose(serialize = false,deserialize = false)
private Long id;
@NotNull
private String owner;
private Date raffleDate;
private String thumbnailUrl;
@ToMany(referencedJoinProperty = "giveawayId")
private List<Influencer> mustFollowList;
@NotNull
@Convert(converter = GiveawayCommentTypeConverter.class, columnType = Integer.class)
private GiveawayCommentType tipo;
private String specifWordValue;
private Integer amountFriendsToIndicate;
@NotNull
@Unique
private String mediaId;
//to reflect the relationships
@ToMany(referencedJoinProperty = "raffle")
@Expose(deserialize = false, serialize = false)
private List<UserOnGiveaway> attendantsTickets;
}
Run Code Online (Sandbox Code Playgroud)
你可以看到我有2个字段,我不想被序列化,所以我用它注释expose = false,但即使有这个Gson正在尝试序列化它们并崩溃到期OutOfMemory.(UserOnGiveaway与Giveaway有一个循环引用,这解释了它崩溃的原因.)
Gson代码是: …
我收到了一封来自谷歌的非常令人不安的电子邮件:
我们对
app name、 和进行了审核,package name发现您的应用程序使用的软件包含用户安全漏洞。具有这些漏洞的应用程序可能会暴露用户信息或损坏用户的设备,并可能被视为违反我们的恶意行为政策。以下是在您最近提交的文件中检测到的问题和相应 APK 版本的列表。请尽快迁移您的应用以使用更新后的软件,并增加升级后的 APK 的版本号。
漏洞 APK 版本修复 TrustManager 的截止日期 您可以在这篇 Google 帮助中心文章中找到有关 TrustManager 的更多信息。
486 2020 年 9 月 14 日漏洞 APK 版本修复截止日期要确认您已正确升级,请将应用的更新版本提交到 Play 管理中心,并在五小时后回来查看。如果应用程序未正确更新,我们将显示警告消息。
虽然这些漏洞可能不会影响每个应用程序,但最好及时更新所有安全补丁。
如果您对该漏洞有技术问题,可以发布到 Stack Overflow 并使用标签“android-security”。有关解决此问题所需采取的步骤的说明,您可以联系我们的开发人员支持团队。
最好的事物,
Google Play 团队
应用程序版本 486 上添加的唯一新内容是我添加到某些数据中的 RSA 加密。
这种加密是通过以下方式进行的:我手动生成了一个 RSA 密钥对,将私钥存储在我的服务器中,并将公钥与 apk 一起部署。
对于应用程序中的某些请求,我使用公钥加密数据,然后URLConnection在服务器端使用发布请求发送数据,然后对其进行解密和处理,然后将响应发送回用户UNENCRYPTED。
所以请考虑以下几点:
0- 应用程序中只有两个使用此技术
的请求 1- 进行此更新是为了确保到达服务器的所有请求都来自我的官方应用程序,因为上周我收到了 3 次 DoS 攻击
2- 这些请求已经存在很长时间了,并且始终使用标准的 android 系统HTTPSUrlConnection而没有任何额外的加密......我现在所做的是添加一个额外的加密层(它怎么能让应用程序不那么安全?) 3- 传输的数据完全无害
我知道什么是 MITM 攻击并且我已经做了很长时间来逆向工程一些应用程序,我不能在不修改编译代码的情况下对我的应用程序进行这种类型的攻击 …
我正在使用本教程:https : //firebase.google.com/docs/auth/admin/create-custom-tokens#using_a_service_account_id
创建一个 node.js 函数(部署到谷歌云函数)来验证我的用户。功能超级简单:
const admin = require('firebase-admin');
admin.initializeApp({
serviceAccountId: 'authenticator@igibo-b0b27.iam.gserviceaccount.com'
});
exports.authenticate = (req, res) => {
let pass;
let uid;
if (req.query) {
if (req.query.v == 3) {
pass = req.query.p;
uid = req.query.u;
}
admin.auth().createCustomToken(uid)
.then(function(customToken) {
res.status(200).send(customToken);
return customToken;
})
.catch(function(error) {
console.error("Error creating custom token:" + JSON.stringify(error));
res.status(400).send(error);
});
} else {
console.error("EMPTY to authentication");
res.end();
}
};
Run Code Online (Sandbox Code Playgroud)
但我收到了这个烦人的错误:
{"code":"auth/insufficient-permission","message":"Permission iam.serviceAccounts.signBlob is required to perform this operation on service account projects/-/serviceAccounts/authenticator@igibo-b0b27.iam.gserviceaccount.com.; Please …Run Code Online (Sandbox Code Playgroud) android ×9
firebase ×2
admob ×1
android-11 ×1
encryption ×1
google-play ×1
gson ×1
json ×1
margin ×1
motorola ×1
okhttp ×1
trim ×1