Commit db117989 authored by Drahomír Karchňák's avatar Drahomír Karchňák

WIP - RMBTAndroid project finally works in Android Studio. Updated gradle and...

WIP - RMBTAndroid project finally works in Android Studio. Updated gradle and got rid of crashlytics. Still need get gradle properties to work correctly.
parent 400aa872
## Java
*.class
*.war
*.ear
hs_err_pid*
## Android Studio
*.ipr
*.iws
*.iml
.idea/
out/
## Gradle
build/
.gradle/
*.iml
gradle.properties
## OS Specific
.DS_Store
## General
*.zip
......@@ -16,12 +16,15 @@
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.+'
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
......@@ -29,13 +32,11 @@ subprojects {
evaluationDependsOn(':RMBTClient')
}
apply plugin: 'android'
apply plugin: 'crashlytics'
apply plugin: 'com.android.application'
repositories {
mavenCentral()
maven{url 'http://repository.pentaho.org/artifactory/repo/'}
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
......@@ -44,7 +45,6 @@ dependencies {
compile 'com.google.android.gms:play-services:4.+' // Not supported in Eclipse now. Needs to install Google play Services from Android SDK Manager and use it as a library project.
compile 'dnsjava:dnsjava:2.1.6'
compile 'net.sf.jopt-simple:jopt-simple:3.2'
compile 'com.crashlytics.android:crashlytics:1.+'
}
task prepareDebugVersion(dependsOn: 'processDebugManifest') {
......@@ -131,49 +131,49 @@ task prepareReleaseVersion(dependsOn: 'processReleaseManifest') {
}
}
task prepareCrashlyticsDebug(dependsOn: 'processDebugManifest') {
doLast{
// api key
File manifest = file("${buildDir}/intermediates/manifests/full/debug/AndroidManifest.xml")
String manifestContent = manifest.getText('UTF-8')
if (project.hasProperty('RMBT_CRASHLYTICS_APIKEY')) {
manifestContent = manifestContent.replaceAll(/RMBT_CRASHLYTICS_APIKEY/, RMBT_CRASHLYTICS_APIKEY)
}
// bug reporting
if (project.hasProperty('RMBT_USE_BUGREPORT')) {
manifestContent = manifestContent.replaceAll(/RMBT_USE_BUGREPORT/, RMBT_USE_BUGREPORT)
}
manifest.write(manifestContent, 'UTF-8')
// api secret
if (project.hasProperty('RMBT_CRASHLYTICS_APISECRET')) {
File crashlytics = file("crashlytics.properties")
crashlytics.write(/apiSecret=/ + RMBT_CRASHLYTICS_APISECRET, 'UTF-8')
}
}
}
task prepareCrashlyticsRelease(dependsOn: 'processReleaseManifest') {
doLast{
// api key
File manifest = file("${buildDir}/intermediates/manifests/full/release/AndroidManifest.xml")
String manifestContent = manifest.getText('UTF-8')
if (project.hasProperty('RMBT_CRASHLYTICS_APIKEY')) {
manifestContent = manifestContent.replaceAll(/RMBT_CRASHLYTICS_APIKEY/, RMBT_CRASHLYTICS_APIKEY)
}
// bug reporting
if (project.hasProperty('RMBT_USE_BUGREPORT')) {
manifestContent = manifestContent.replaceAll(/RMBT_USE_BUGREPORT/, RMBT_USE_BUGREPORT)
}
manifest.write(manifestContent, 'UTF-8')
// api secret
if (project.hasProperty('RMBT_CRASHLYTICS_APISECRET')) {
File crashlytics = file("crashlytics.properties")
crashlytics.write(/apiSecret=/ + RMBT_CRASHLYTICS_APISECRET, 'UTF-8')
}
}
}
//task prepareCrashlyticsDebug(dependsOn: 'processDebugManifest') {
// doLast{
// // api key
// File manifest = file("${buildDir}/intermediates/manifests/full/debug/AndroidManifest.xml")
// String manifestContent = manifest.getText('UTF-8')
// if (project.hasProperty('RMBT_CRASHLYTICS_APIKEY')) {
// manifestContent = manifestContent.replaceAll(/RMBT_CRASHLYTICS_APIKEY/, RMBT_CRASHLYTICS_APIKEY)
// }
// // bug reporting
// if (project.hasProperty('RMBT_USE_BUGREPORT')) {
// manifestContent = manifestContent.replaceAll(/RMBT_USE_BUGREPORT/, RMBT_USE_BUGREPORT)
// }
// manifest.write(manifestContent, 'UTF-8')
//
// // api secret
// if (project.hasProperty('RMBT_CRASHLYTICS_APISECRET')) {
// File crashlytics = file("crashlytics.properties")
// crashlytics.write(/apiSecret=/ + RMBT_CRASHLYTICS_APISECRET, 'UTF-8')
// }
// }
//}
//task prepareCrashlyticsRelease(dependsOn: 'processReleaseManifest') {
// doLast{
// // api key
// File manifest = file("${buildDir}/intermediates/manifests/full/release/AndroidManifest.xml")
// String manifestContent = manifest.getText('UTF-8')
// if (project.hasProperty('RMBT_CRASHLYTICS_APIKEY')) {
// manifestContent = manifestContent.replaceAll(/RMBT_CRASHLYTICS_APIKEY/, RMBT_CRASHLYTICS_APIKEY)
// }
// // bug reporting
// if (project.hasProperty('RMBT_USE_BUGREPORT')) {
// manifestContent = manifestContent.replaceAll(/RMBT_USE_BUGREPORT/, RMBT_USE_BUGREPORT)
// }
// manifest.write(manifestContent, 'UTF-8')
//
// // api secret
// if (project.hasProperty('RMBT_CRASHLYTICS_APISECRET')) {
// File crashlytics = file("crashlytics.properties")
// crashlytics.write(/apiSecret=/ + RMBT_CRASHLYTICS_APISECRET, 'UTF-8')
// }
// }
//}
tasks.whenTaskAdded { task ->
if (task.name == 'processDebugResources')
......@@ -185,15 +185,15 @@ tasks.whenTaskAdded { task ->
task.dependsOn prepareReleaseVersion
}
tasks.whenTaskAdded { task ->
if (task.name == 'crashlyticsGenerateResourcesDebug')
task.dependsOn prepareCrashlyticsDebug
}
tasks.whenTaskAdded { task ->
if (task.name == 'crashlyticsGenerateResourcesRelease')
task.dependsOn prepareCrashlyticsRelease
}
//tasks.whenTaskAdded { task ->
// if (task.name == 'crashlyticsGenerateResourcesDebug')
// task.dependsOn prepareCrashlyticsDebug
//}
//
//tasks.whenTaskAdded { task ->
// if (task.name == 'crashlyticsGenerateResourcesRelease')
// task.dependsOn prepareCrashlyticsRelease
//}
// copy NDT resources to android debug
tasks.whenTaskAdded { task ->
......@@ -226,7 +226,6 @@ tasks.whenTaskAdded { task ->
android {
compileSdkVersion 19
buildToolsVersion "20"
sourceSets {
main {
......@@ -248,7 +247,7 @@ android {
buildTypes.all { buildType ->
buildConfigField "String", "CLIENT_SECRET", project.hasProperty('RMBT_CLIENT_SECRET') ? String.format("\"%s\"", RMBT_CLIENT_SECRET) : "null"
ext.enableCrashlytics = project.hasProperty('RMBT_CRASHLYTICS_APIKEY')
// ext.enableCrashlytics = project.hasProperty('RMBT_CRASHLYTICS_APIKEY')
}
defaultConfig {
......
......@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
......@@ -47,7 +47,6 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.crashlytics.android.Crashlytics;
import com.google.android.gms.maps.model.LatLng;
import android.app.ActionBar;
......@@ -345,19 +344,19 @@ public class RMBTMainActivity extends Activity implements MapProperties, RMBTLoo
@Override
public void onCreate(final Bundle savedInstanceState)
{
//Log.i("MAIN ACTIVITY", "onCreate");
restoreInstance(savedInstanceState);
super.onCreate(savedInstanceState);
// BUG REPORT
try {
boolean bugReportEnabled = getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA).metaData.getBoolean(BUG_REPORT_MANIFEST_PROPERTY, false);
if (bugReportEnabled) {
Crashlytics.start(this);
}
} catch (NameNotFoundException e) {
// nothing needed
}
// TODO - Add Sentry
// try {
// boolean bugReportEnabled = getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA).metaData.getBoolean(BUG_REPORT_MANIFEST_PROPERTY, false);
// if (bugReportEnabled) {
// Crashlytics.start(this);
// }
// } catch (NameNotFoundException e) {
// // nothing needed
// }
NetworkInfoCollector.init(this);
networkInfoCollector = NetworkInfoCollector.getInstance();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment