diff --git a/build.gradle b/build.gradle index 0f7be57..a5644e1 100644 --- a/build.gradle +++ b/build.gradle @@ -9,8 +9,8 @@ buildscript { } } dependencies { - classpath 'com.android.tools.build:gradle:3.0.0' - classpath 'io.fabric.tools:gradle:1.24.5' + classpath 'com.android.tools.build:gradle:3.3.0-alpha05' + classpath 'io.fabric.tools:gradle:1.25.4' } } @@ -20,6 +20,7 @@ allprojects { repositories { jcenter() + google() maven { url 'https://maven.fabric.io/public' } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index af6a17f..04c9b19 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Nov 20 11:40:43 CET 2017 +#Wed Aug 08 15:27:42 CEST 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip diff --git a/library-no-op/.gitignore b/library-no-op/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/library-no-op/.gitignore @@ -0,0 +1 @@ +/build diff --git a/library-no-op/build.gradle b/library-no-op/build.gradle new file mode 100644 index 0000000..89f8a00 --- /dev/null +++ b/library-no-op/build.gradle @@ -0,0 +1,26 @@ +apply plugin: 'com.android.library' + +android { + compileSdkVersion 28 + buildToolsVersion "28.0.1" + + defaultConfig { + minSdkVersion 9 + targetSdkVersion 28 + versionCode 5 + versionName "1.2.2-SNAPSHOT" + } + buildTypes { + release { + minifyEnabled false + } + } +} + +apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle' + +dependencies { + implementation('com.crashlytics.sdk.android:crashlytics:2.9.3@aar') { + transitive = true + } +} diff --git a/library-no-op/gradle.properties b/library-no-op/gradle.properties new file mode 100644 index 0000000..8996eb0 --- /dev/null +++ b/library-no-op/gradle.properties @@ -0,0 +1,3 @@ +POM_NAME=LogcatReporter library +POM_ARTIFACT_ID=logcatreporter +POM_PACKAGING=jar \ No newline at end of file diff --git a/library-no-op/src/main/AndroidManifest.xml b/library-no-op/src/main/AndroidManifest.xml new file mode 100644 index 0000000..21806b0 --- /dev/null +++ b/library-no-op/src/main/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/library-no-op/src/main/java/cat/ereza/logcatreporter/LogcatReporter.java b/library-no-op/src/main/java/cat/ereza/logcatreporter/LogcatReporter.java new file mode 100644 index 0000000..8f99388 --- /dev/null +++ b/library-no-op/src/main/java/cat/ereza/logcatreporter/LogcatReporter.java @@ -0,0 +1,42 @@ +/* + * Copyright 2016-2017 Eduard Ereza Martínez + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cat.ereza.logcatreporter; + +public class LogcatReporter { + + private static final String TAG = "LogcatReporter"; + + private static final int DEFAULT_WAIT_TIME_IN_MILLIS = 500; + private static final int DEFAULT_LINE_COUNT = 1000; + + private static int lineCount; + + public static void install() { + } + + public static void install(int lineCount) { + } + + public static void install(final int lineCount, final int waitTimeInMillis) { + } + + public static void reportExceptionWithLogcat(Throwable t) { + } + + private static void logLogcat() { + } +} diff --git a/library/build.gradle b/library/build.gradle index 5619f12..89f8a00 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,14 +1,14 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 27 - buildToolsVersion "27.0.1" + compileSdkVersion 28 + buildToolsVersion "28.0.1" defaultConfig { minSdkVersion 9 - targetSdkVersion 27 - versionCode 4 - versionName "1.2.1-SNAPSHOT" + targetSdkVersion 28 + versionCode 5 + versionName "1.2.2-SNAPSHOT" } buildTypes { release { @@ -20,7 +20,7 @@ android { apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle' dependencies { - compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') { + implementation('com.crashlytics.sdk.android:crashlytics:2.9.3@aar') { transitive = true } } diff --git a/sample-no-op/.gitignore b/sample-no-op/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/sample-no-op/.gitignore @@ -0,0 +1 @@ +/build diff --git a/sample-no-op/build.gradle b/sample-no-op/build.gradle new file mode 100644 index 0000000..b9f84af --- /dev/null +++ b/sample-no-op/build.gradle @@ -0,0 +1,36 @@ +apply plugin: 'com.android.application' +apply plugin: 'io.fabric' + +repositories { + maven { url 'https://maven.fabric.io/public' } +} + +android { + compileSdkVersion 28 + buildToolsVersion '28.0.1' + + defaultConfig { + applicationId "cat.ereza.logcatreporter.sample" + minSdkVersion 9 + targetSdkVersion 28 + versionCode 4 + versionName "1.2.1-SNAPSHOT" + } + buildTypes { + debug { + minifyEnabled false + proguardFiles 'proguard-rules.pro' + } + release { + minifyEnabled false + proguardFiles 'proguard-rules.pro' + } + } +} + +dependencies { + implementation project(":library-no-op") + implementation('com.crashlytics.sdk.android:crashlytics:2.9.3@aar') { + transitive = true; + } +} diff --git a/sample-no-op/proguard-rules.pro b/sample-no-op/proguard-rules.pro new file mode 100644 index 0000000..3d97595 --- /dev/null +++ b/sample-no-op/proguard-rules.pro @@ -0,0 +1 @@ +# No special config needed for LogcatReporter! :D diff --git a/sample-no-op/src/main/AndroidManifest.xml b/sample-no-op/src/main/AndroidManifest.xml new file mode 100644 index 0000000..6994a8d --- /dev/null +++ b/sample-no-op/src/main/AndroidManifest.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + diff --git a/sample-no-op/src/main/java/cat/ereza/logcatreporter/sample/SampleCrashingApplication.java b/sample-no-op/src/main/java/cat/ereza/logcatreporter/sample/SampleCrashingApplication.java new file mode 100644 index 0000000..517f690 --- /dev/null +++ b/sample-no-op/src/main/java/cat/ereza/logcatreporter/sample/SampleCrashingApplication.java @@ -0,0 +1,41 @@ +/* + * Copyright 2016-2017 Eduard Ereza Martínez + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cat.ereza.logcatreporter.sample; + +import android.app.Application; + +import com.crashlytics.android.Crashlytics; + +import cat.ereza.logcatreporter.LogcatReporter; +import io.fabric.sdk.android.Fabric; + +public class SampleCrashingApplication extends Application{ + @Override + public void onCreate() { + super.onCreate(); + + //Initialize Crashlytics as normal + Fabric.with(this, new Crashlytics()); + + //Install LogcatReporter + LogcatReporter.install(); + + //You can algo use the following: +// LogcatReporter.install(2000, 500); + + } +} diff --git a/sample-no-op/src/main/java/cat/ereza/logcatreporter/sample/activity/MainActivity.java b/sample-no-op/src/main/java/cat/ereza/logcatreporter/sample/activity/MainActivity.java new file mode 100644 index 0000000..53aadf7 --- /dev/null +++ b/sample-no-op/src/main/java/cat/ereza/logcatreporter/sample/activity/MainActivity.java @@ -0,0 +1,56 @@ +/* + * Copyright 2016-2017 Eduard Ereza Martínez + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cat.ereza.logcatreporter.sample.activity; + +import android.app.Activity; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.Toast; + +import java.util.UUID; + +import cat.ereza.logcatreporter.sample.R; + +public class MainActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + Button logButton = (Button) findViewById(R.id.button_log); + Button crashButton = (Button) findViewById(R.id.button_crash); + + logButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + String loggedString = "This is a test log! - " + UUID.randomUUID().toString(); + Log.e("TEST_TAG", loggedString); + Toast.makeText(MainActivity.this, getString(R.string.logged_toast, loggedString), Toast.LENGTH_SHORT).show(); + } + }); + + crashButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + throw new RuntimeException("Hi! I'm an exception and I made the app crash!"); + } + }); + } +} \ No newline at end of file diff --git a/sample-no-op/src/main/res/layout/activity_main.xml b/sample-no-op/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..066d652 --- /dev/null +++ b/sample-no-op/src/main/res/layout/activity_main.xml @@ -0,0 +1,30 @@ + + + + + +