小编Paw*_*wel的帖子

GCM http 401授权错误

当我的后端服务器向GCM服务器发送post请求时,我收到HTTP 401的授权错误.

我按照这里描述的步骤:

http://developer.android.com/google/gcm/http.html#auth_error

>> api_key=AIzaSyDEy3...

>> curl --header "Authorization: key=$api_key" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send  -d "{\"registration_id\":\"ABC\"}"
Run Code Online (Sandbox Code Playgroud)

我明白了:

<HTML>
<HEAD>
<TITLE>Unauthorized</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unauthorized</H1>
<H2>Error 401</H2>
</BODY>
</HTML>
Run Code Online (Sandbox Code Playgroud)

在故障排除中它说:

Authentication Error
The sender account that you're trying to use to send a message couldn't be authenticated. Possible causes are:
    1. Authorization header missing or with invalid syntax.
    2. Invalid project number sent as key.
    3. Key valid but with GCM service disabled.
    4. Request originated from a server not …
Run Code Online (Sandbox Code Playgroud)

android push-notification http-status-code-401 google-cloud-messaging

36
推荐指数
6
解决办法
8万
查看次数

Google Play Services v23 Proguard配置

升级到Google Play服务v23后,我在尝试在Eclipse中导出已签名的应用程序时看到此消息:

Proguard returned with error code 1. See console
Warning: com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced class android.content.pm.PackageInstaller
Warning: com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced class android.content.pm.PackageInstaller$SessionInfo
Warning: com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced class android.content.pm.PackageInstaller
Warning: com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced class android.content.pm.PackageInstaller$SessionInfo
Warning: com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced method 'android.content.pm.PackageInstaller getPackageInstaller()' in class android.content.pm.PackageManager
Warning: com.google.android.gms.internal.zzif: can't find referenced method 'void setMixedContentMode(int)' in class android.webkit.WebSettings
      You should check if you need to specify additional program jars.
Warning: there were 4 unresolved references to classes or …
Run Code Online (Sandbox Code Playgroud)

android proguard google-play-services

13
推荐指数
3
解决办法
1万
查看次数

AdMob无填充 - 无法实例化中介适配器:com.google.DummyAdapter

我的应用仅使用AdMob.它是AdMob中介设置中显示的唯一"中介源".AdMob横幅广告已加载,但不是插页式广告:

I/Ads: Starting ad request.
I/Ads: Trying mediation network: 
I/Ads: Instantiating mediation adapter: com.google.DummyAdapter
W/Ads: Could not instantiate mediation adapter: com.google.DummyAdapter. com.google.DummyAdapter
I/Ads: No fill from any mediation ad networks.
W/Ads: Failed to load ad: 3
Run Code Online (Sandbox Code Playgroud)

什么是DummyAdapter?我的应用中没有使用中介适配器.

android admob

12
推荐指数
1
解决办法
2904
查看次数

Xcode记住折叠/打开的文件夹

我有一个包含许多文件夹/组的大型iOS项目.当我退出并重新启动Xcode时,Project Navigator中的所有文件夹都显示为展开,因此我必须手动折叠其中的大多数文件夹.

是否可以保存Project Navigator的状态,以便在Xcode重新启动时,像以前一样折叠/展开相同的文件夹?

xcode expand savestate collapse project-navigator

9
推荐指数
1
解决办法
2339
查看次数

调试Linux for iPhone/shell命令提示符

对于Android,有ADB(Android调试桥)允许在连接的设备上获取shell:

adb shell

iOS有类似的东西吗?

我想在我的Mac上键入一些shell命令,这些命令将在连接的iPhone上执行.
iPhone上有内置终端吗?

shell terminal command-line adb ios

7
推荐指数
1
解决办法
6607
查看次数

检查Android系统设置中是否启用了"自动更新"

是否有可能以编程方式检查这个?

设置 - >关于设备 - >软件更新 - >自动更新(自动检查更新)

android auto-update isenabled

6
推荐指数
0
解决办法
205
查看次数

Google Analytics V4 - 无法识别bool配置名称

我在Logcat中看到了这个:

W/GAV4: String xml configuration name not recognized:  ga_trackingId
W/GAV4: Bool xml configuration name not recognized:  ga_autoActivityTracking
W/GAV4: Bool configuration name not recognized:  ga_reportUncaughtExceptions
Run Code Online (Sandbox Code Playgroud)

在Manifest.xml中我有:

    <meta-data
        android:name="com.google.android.gms.analytics.globalConfigResource"
        android:resource="@xml/track" />
Run Code Online (Sandbox Code Playgroud)

在App.java中:

        GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
        Tracker t = analytics.newTracker(R.xml.track);
Run Code Online (Sandbox Code Playgroud)

在track.xml中:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="ga_trackingId">UA-****</string>
    <string name="ga_logLevel">error</string>
    <bool name="ga_autoActivityTracking">true</bool>
    <bool name="ga_reportUncaughtExceptions">true</bool>
    <bool name="ga_dryRun">false</bool>
    <integer name="ga_dispatchPeriod">120</integer>
</resources>
Run Code Online (Sandbox Code Playgroud)

是否忽略配置文件中的布尔参数?

android google-analytics

6
推荐指数
1
解决办法
1308
查看次数

java.lang.RuntimeException:无法实例化应用程序

在 Google Play Developer Console 中,我看到此崩溃:

java.lang.RuntimeException: Unable to instantiate application com.example.MyApp: java.lang.ClassNotFoundException: Didn't find class "com.example.MyApp" on path: DexPathList[[zip file "/mnt/asec/com.example.testapp-1/pkg.apk"],nativeLibraryDirectories=[/mnt/asec/com.example.testapp-1/lib, /vendor/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:516)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4545)
at android.app.ActivityThread.access$1500(ActivityThread.java:160)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1390)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5330)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.MyApp" on path: DexPathList[[zip file "/mnt/asec/com.example.testapp-1/pkg.apk"],nativeLibraryDirectories=[/mnt/asec/com.example.testapp-1/lib, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.Instrumentation.newApplication(Instrumentation.java:975)
at android.app.LoadedApk.makeApplication(LoadedApk.java:511)
... 11 more
Suppressed: java.io.IOException: unable …
Run Code Online (Sandbox Code Playgroud)

crash android updates apk

5
推荐指数
1
解决办法
5144
查看次数

安卓每秒帧数

是否可以以编程方式获取这些值:

  • 每秒帧数
  • onDraw()如果整个 View 立即失效,则调用该方法的频率。

android frame-rate

5
推荐指数
1
解决办法
1196
查看次数

如何在Google Play上打击垃圾评论?

有人向我的应用发布了垃圾评论(嵌入式广告和链接).然后,他让许多其他垃圾邮件发送者将此评论标记为"有用".现在,此垃圾邮件审核在列表顶部显示为"最有帮助".他每天都重新发布这篇评论,以便保持最佳状态.

我曾多次尝试将此评论标记为垃圾邮件,但未将其删除.显然,"这是有用的"投票比"这是垃圾邮件"投票更多.

如何删除垃圾邮件?

android spam-prevention review google-play

5
推荐指数
1
解决办法
1618
查看次数

如何检测 AdMob 插页式广告已关闭?

根据文件

公共无效onAdClosed()

当用户单击广告后即将返回应用程序时调用。

但如何检测用户关闭插页式 Activity 呢?(而不是点击广告后打开的网页)

这个问题中接受的答案似乎是错误的: How to detector when the user matches a interstitial in Admob?

(用户返回应用程序后,插页式广告仍然可见)。

android admob

3
推荐指数
1
解决办法
3519
查看次数

Java:如何自动检查哪些字段需要 volatile 修饰符?

volatile当多个并发线程读/写变量时需要修饰符。

是否有工具可以volatile自动检测缺少的修饰符,例如在 Android Studio 中?

算法:

for (Class c:allClasses) {
    for (Field f:allFields) {
        List<Method> allMethods = getCallHierarchy(field);
        
        for (Method m:allMethods) {
            List<Thread> threads = getCallingThreads();
            if (threads.size() > 1) {
                Log.w("Warning: field "+f+" is accessed by several threads.");
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

测试算法的代码:

public class Foo {
    private int a; //accessed by only one Thread - ok
    private int b; //accessed by two Threads - show compiler warning

    public static void main(String[] args) {
        a = …
Run Code Online (Sandbox Code Playgroud)

java volatile android-studio

0
推荐指数
1
解决办法
173
查看次数