Skip to content
This repository has been archived by the owner on Feb 5, 2020. It is now read-only.

Commit

Permalink
Bump target sdk version; use fabric instead of GA for crash reporting.
Browse files Browse the repository at this point in the history
  • Loading branch information
restorer committed Jul 2, 2018
1 parent b9c37a8 commit 4b48390
Show file tree
Hide file tree
Showing 20 changed files with 123 additions and 157 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/*.iml
.DS_Store
/.externalNativeBuild
/.gradle
/.idea
/*.iml
/build
/infer-out
/local.properties
/temp
/tools/signing.keystore
/tools/signing.properties
.DS_Store
77 changes: 49 additions & 28 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,47 @@
buildscript {
ext.ver_crashlytics = '2.9.4' // https://docs.fabric.io/android/changelog.html#crashlytics
ext.ver_fabricPlugin = '1.25.4' // https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
// ext.ver_fabric = '1.4.3'
// ext.ver_gameanalytics = '3.5.5'

repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.android.tools.build:gradle:3.1.3'
classpath "io.fabric.tools:gradle:${ver_fabricPlugin}"
}
}

apply plugin: 'com.android.application'

allprojects {
repositories {
google()
jcenter()
mavenCentral()
// maven { url 'http://maven.gameanalytics.com/release' }
maven { url 'https://maven.fabric.io/public' }
}

tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:all'
options.compilerArgs << '-Xlint:-deprecation'
options.compilerArgs << '-Xlint:-unchecked'
}
}

// task clean(type: Delete) {
// delete rootProject.buildDir
// }

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
compileSdkVersion 27
buildToolsVersion '27.0.3'

externalNativeBuild {
cmake {
Expand All @@ -29,21 +50,11 @@ android {
}

defaultConfig {
minSdkVersion 7
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)

versionName project.VERSION_NAME
versionCode Integer.parseInt(project.VERSION_CODE)

externalNativeBuild {
cmake {
cFlags '-Werror'
}
}
minSdkVersion 9 // min 9 for fabric, min 14 for gameanalytics
targetSdkVersion 27

ndk {
abiFilters 'armeabi', 'armeabi-v7a', 'mips', 'x86' // 'arm64-v8a', 'mips64', 'x86_64'
}
versionName '2018.07.02'
versionCode 1807020000
}

if (new File('tools/signing.properties').exists()) {
Expand Down Expand Up @@ -79,13 +90,11 @@ android {
gplaynormal {
dimension 'package'
applicationId 'zame.GloomyDungeons.freedemo.game'
buildConfigField 'String', 'GA_ACCT', '"UA-1782921-31"'
}

gplayhardcore {
dimension 'package'
applicationId 'org.zamedev.gloomydungeons1hardcore.gplay'
buildConfigField 'String', 'GA_ACCT', '"UA-1782921-32"'
}

fdroidnormal {
Expand All @@ -108,23 +117,18 @@ android {

withoutanalytics {
dimension 'analytics'
buildConfigField 'boolean', 'WITH_ANALYTICS', 'false'
buildConfigField 'String', 'GA_ACCT', '""'
}

withanalytics {
dimension 'analytics'
buildConfigField 'boolean', 'WITH_ANALYTICS', 'true'
}

withoutzeemote {
dimension 'zeemote'
buildConfigField 'boolean', 'WITH_ZEEMOTE', 'false'
}

withzeemote {
dimension 'zeemote'
buildConfigField 'boolean', 'WITH_ZEEMOTE', 'true'
}

withoutrateoffer {
Expand All @@ -135,9 +139,26 @@ android {
dimension 'rateoffer'
}
}

externalNativeBuild {
cmake {
path 'src/main/cpp/CMakeLists.txt'
}
}
}

dependencies {
withanalyticsCompile fileTree(dir: 'src/withanalytics/libs', include: [ '*.jar' ])
withzeemoteCompile fileTree(dir: 'src/withzeemote/libs', include: [ '*.jar' ])
withanalyticsImplementation("com.crashlytics.sdk.android:crashlytics:${ver_crashlytics}@aar") {
transitive = true
}

// withanalyticsImplementation("com.gameanalytics.sdk:gameanalytics-android:${ver_gameanalytics}@aar") {
// transitive = true
// }

// withanalyticsImplementation("io.fabric.sdk.android:fabric:${ver_fabric}@aar") {
// transitive = true
// }

withzeemoteImplementation fileTree(dir: 'src/withzeemote/libs', include: [ '*.jar' ])
}
5 changes: 0 additions & 5 deletions gradle.properties

This file was deleted.

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Mar 23 12:10:54 MSK 2017
#Fri Mar 30 17:17:20 MSK 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
4 changes: 4 additions & 0 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
android:name="zame.game.ZameApplication"
tools:ignore="GoogleAppIndexingWarning">

<meta-data
android:name="android.max_aspect"
android:value="2.1" />

<activity
android:alwaysRetainTaskState="true"
android:configChanges="keyboard|keyboardHidden|orientation"
Expand Down
11 changes: 11 additions & 0 deletions src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.4.1)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")

add_library(renderer SHARED
renderer.c)

target_link_libraries(renderer
android
log
GLESv1_CM)
File renamed without changes.
6 changes: 2 additions & 4 deletions src/main/java/zame/game/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static void initialize() {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(ZameApplication.self);
String controlsTypeStr = sp.getString("ControlsType", "PadL");

if (BuildConfig.WITH_ZEEMOTE && "Zeemote".equals(controlsTypeStr)) {
if (ConfigZeemote.isZeemoteControlsType(controlsTypeStr)) {
controlsType = Controls.TYPE_ZEEMOTE;
} else if ("Classic".equals(controlsTypeStr) || "TypeA".equals(controlsTypeStr)) {
controlsType = Controls.TYPE_CLASSIC;
Expand Down Expand Up @@ -108,9 +108,7 @@ public static void initialize() {
levelTextureFilter = (sp.getBoolean("LevelTextureSmoothing", false) ? GL10.GL_LINEAR : GL10.GL_NEAREST);
weaponsTextureFilter = (sp.getBoolean("WeaponsTextureSmoothing", true) ? GL10.GL_LINEAR : GL10.GL_NEAREST);

if (BuildConfig.WITH_ZEEMOTE) {
ConfigZeemote.initialize(sp);
}
ConfigZeemote.initialize(sp);

keyMappings = new int[KeyEvent.getMaxKeyCode()];

Expand Down
32 changes: 9 additions & 23 deletions src/main/java/zame/game/GameActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,9 @@ public void run() {
@Override
protected void onCreate(Bundle state) {
super.onCreate(state);
self = this;

if (BuildConfig.WITH_ZEEMOTE) {
zeemoteHelper = new GameActivityZeemoteHelper();
}
self = this;
zeemoteHelper = new GameActivityZeemoteHelper();

SoundManager.init(getApplicationContext(), getAssets(), true);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
Expand Down Expand Up @@ -147,17 +145,14 @@ public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);

MenuInflater inflater = getMenuInflater();
inflater.inflate((zeemoteHelper == null) ? R.menu.game : zeemoteHelper.getMenuResId(), menu);
inflater.inflate((zeemoteHelper.getMenuResId() == 0) ? R.menu.game : zeemoteHelper.getMenuResId(), menu);

return true;
}

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
if (zeemoteHelper != null) {
zeemoteHelper.onPrepareOptionsMenu(menu);
}

zeemoteHelper.onPrepareOptionsMenu(menu);
return super.onPrepareOptionsMenu(menu);
}

Expand All @@ -179,12 +174,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
return true;
}

//noinspection SimplifiableIfStatement
if (zeemoteHelper != null) {
return zeemoteHelper.onOptionsItemSelected(item);
} else {
return false;
}
return zeemoteHelper.onOptionsItemSelected(item);
}

@Override
Expand All @@ -197,11 +187,9 @@ public void onBackPressed() {
@Override
protected void onStart() {
super.onStart();
Config.initialize();

if (zeemoteHelper != null) {
zeemoteHelper.onStart(this);
}
Config.initialize();
zeemoteHelper.onStart(this);

if (Config.accelerometerEnabled) {
sensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
Expand Down Expand Up @@ -258,11 +246,9 @@ protected void onResume() {
@Override
protected void onPause() {
super.onPause();
justAfterPause = true;

if (zeemoteHelper != null) {
zeemoteHelper.onPause();
}
justAfterPause = true;
zeemoteHelper.onPause();

if (!soundAlreadyStopped) {
SoundManager.onPause(instantMusicPause);
Expand Down
12 changes: 5 additions & 7 deletions src/main/java/zame/game/ZameApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ public class ZameApplication extends Application {
private String cachedVersionName;

@SuppressWarnings("ConstantConditions")
private ZameApplicationAnalyticsHelper analyticsHelper = (BuildConfig.WITH_ANALYTICS
? new ZameApplicationAnalyticsHelper()
: null);
private ZameApplicationAnalyticsHelper analyticsHelper = new ZameApplicationAnalyticsHelper();

public static void trackPageView(String pageUrl) {
if ((ZameApplication.self != null) && (ZameApplication.self.analyticsHelper != null)) {
Expand All @@ -36,7 +34,9 @@ public static void flushEvents() {
@Override
public void onCreate() {
super.onCreate();

self = this;
analyticsHelper.onCreate(this);

SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
PreferenceManager.setDefaultValues(getApplicationContext(), R.xml.preferences, false);
Expand All @@ -51,12 +51,10 @@ public void onCreate() {
spEditor.putString("InitialControlsType", initialControlsType);
spEditor.putString("ControlsType", initialControlsType);
spEditor.putString("PrevControlsType", initialControlsType);
spEditor.commit();
spEditor.apply();
}

if (analyticsHelper != null) {
analyticsHelper.onCreate(this, initialControlsType);
}
analyticsHelper.setInitialControlsType(initialControlsType);
}

public String getVersionName() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/zame/game/ZameJniRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@SuppressWarnings("WeakerAccess")
public final class ZameJniRenderer {
static {
System.loadLibrary("zameJniRenderer");
System.loadLibrary("renderer");
}

private ZameJniRenderer() {
Expand Down
8 changes: 0 additions & 8 deletions src/main/jni/CMakeLists.txt

This file was deleted.

14 changes: 4 additions & 10 deletions src/withanalytics/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@
package="zame.game">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application tools:ignore="GoogleAppIndexingWarning">
<application tools:ignore="AllowBackup,GoogleAppIndexingWarning">

<receiver
android:exported="true"
android:name="com.google.android.apps.analytics.AnalyticsReceiver"
tools:ignore="ExportedReceiver">
<meta-data
android:name="io.fabric.ApiKey"
android:value="ecb19f2d73915c06f86059a1048d0eb35664e048" />

<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
</application>
</manifest>
Loading

0 comments on commit 4b48390

Please sign in to comment.