自从我上次在Android Playstore上更新我的应用程序后,我面临着一个不同的问题,此外,在搜索网络时,我无法找到任何接近的问题。最近我们的APK大小突然增加了。经过检查,结果发现libs平台现在支持更新版本的CPU架构(尺寸增加超过40%)。此时,我们决定按照CPU(通过gradle)拆分APK。
发布后,我们开始在广告系列跟踪中遇到问题。我们的广告系我们认为出了问题,所以我们重新审视了分析集成,使用最新的库(play-services-9.0.0)升级了SDK及其相应的配置文件。还执行了活动监控测试。但是,我们的广告系列跟踪仍未按预期运行(归因次数减少80%以上)。
有人能指出我在此设置中缺少的内容吗?在此先感谢:)
作为参考,我发布了build.gradle,AndroidManifest.xml和广告系列接收器文件。
build.gradle(已删除可识别信息)
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:3.0.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.example.app"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0.0"
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = new File(
output.outputFile.parent,
output.outputFile.name.replace(".apk", "-${variant.versionCode}-${variant.versionName}.apk"))
}
}
splits {
abi {
enable true
reset()
include 'arm64-v8a', 'x86', 'armeabi', 'armeabi-v7a', 'mips'/*, 'x86_64', 'mips64'*/
universalApk true
}
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/fonts'] } }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.google.android.gms:play-services-base:9.0.0'
compile 'com.google.android.gms:play-services-plus:9.0.0'
compile 'com.google.android.gms:play-services-analytics:9.0.0'
compile 'com.google.android.gms:play-services-appindexing:9.0.0'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'com.google.android.gms:play-services-location:9.0.0'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true;
}
compile('com.twitter.sdk.android:tweet-composer:0.8.0@aar') {
transitive = true;
}
}
的AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.app" >
<!--android:installLocation="auto" for adoptable storage-->
<uses-permission .... />
<application
android:name="com.example.app.toolbelt.ComBank"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:screenOrientation="portrait"
android:theme="@style/Theme.Light" >
...
<receiver
android:name="com.example.app.services.campaign.CampaignReceiver"
android:enabled="true" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<receiver android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<service android:name="com.google.android.gms.analytics.CampaignTrackingService" />
<!-- Optionally, register AnalyticsReceiver and AnalyticsService to support background
dispatching on non-Google Play devices -->
<receiver android:name="com.google.android.gms.analytics.AnalyticsReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
</intent-filter>
</receiver>
<service android:name="com.google.android.gms.analytics.AnalyticsService"
android:enabled="true"
android:exported="false"/>
</application>
</manifest>
CampaignReceiver.java
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.example.app.toolbelt.ComBank;
import com.example.app.toolbelt.Tracking;
import com.google.android.gms.analytics.CampaignTrackingReceiver;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
/**
* Created by rokha on 1/8/15.
*/
public class CampaignReceiver extends CampaignTrackingReceiver {
static final String TAG = CampaignReceiver.class.getSimpleName();
Tracking tracking;
Context mContext;
@Override
public void onReceive(Context context, Intent intent) {
String rawReferrer = intent.getStringExtra("referrer");
Log.d(TAG, "received broadcast");
if (rawReferrer != null) {
Log.d(TAG, "raw: " + rawReferrer);
String referrer = "";
try {
referrer = URLDecoder.decode(rawReferrer, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace(); // This should not happen.
}
Log.d(TAG, "decoded: " + referrer);
if (ComBank.sharedPref.getString(CampaignHelper.REFERRED, "").length() == 0) {
ComBank.editor.putString(CampaignHelper.REFERRER, referrer).commit();
}
} else {
Log.e(TAG, "referrer is null");
}
super.onReceive(context, intent);
}
}
答案 0 :(得分:0)
尝试使用此类清单中的更改,它将起作用
<receiver
android:name="*.InstallSourceReceiver"
android:exported="true">
<intent-filter android:priority="10">
<action android:name="com.android.vending.INSTALL_REFERRER"/>
</intent-filter>
<meta-data
android:name="forward.GoogleAnalytic"
android:value="com.google.analytics.tracking.android.CampaignTrackingReceiver" />
</receiver>
如果您使用多个接收器进行跟踪,请设置优先级。
要为不同的CPU架构创建多个apk,您应该使用像这样的产品风格
productFlavors {
x86 {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
versionCode 4 + defaultConfig.versionCode
ndk {
abiFilter "x86"
}
}
mips {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
versionCode 3 + defaultConfig.versionCode
ndk {
abiFilter "mips"
}
}
armv7 {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
versionCode 2 + defaultConfig.versionCode
ndk {
abiFilter "armeabi-v7a"
}
}
arm {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
versionCode 1 + defaultConfig.versionCode
ndk {
abiFilter "armeabi"
}
}
}
请同时分享您的广告系列跟踪网址。