From d51aa8ec8a9c8815a2caba84af1a0006d68ce85b Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Mon, 4 Jan 2016 20:49:05 +0100 Subject: [PATCH 1/5] Don't generate a jar file anymore --- CONTRIBUTING.md | 8 ++++---- README.md | 6 ------ build.gradle | 19 ------------------- gradle.properties | 2 +- 4 files changed, 5 insertions(+), 30 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5a7f3981fe..7e6a7e3ab1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,13 +32,13 @@ installed to `~/.android-sdk`. Building the Library --------------------- -You can build new `.jar` and `.aar` files as follows: +You can build new `.aar` files as follows: ```shell ./gradlew clean :build ``` -Files are generated into `build/outputs/jar` and `build/outputs/aar`. +Files are generated into`build/outputs/aar`. Running Tests @@ -128,7 +128,7 @@ This process is a little ridiculous... - Select the com.bugsnag closed repository - Click the “release” button in the toolbar -### 4. Upload the .jar file to GitHub +### 4. Upload the .aar file to GitHub - Create a "release" from your new tag on [GitHub Releases](https://github.com/bugsnag/bugsnag-android/releases) -- Upload the generated `.jar` file from `build/outputs/jar/bugsnag-android-x.y.z.jar` on the "edit tag" page for this release tag +- Upload the generated `.aar` file from `build/outputs/aar/bugsnag-android-release.aar` on the "edit tag" page for this release tag diff --git a/README.md b/README.md index 69f38c25c4..e3e34b61d8 100644 --- a/README.md +++ b/README.md @@ -32,12 +32,6 @@ Add `bugsnag-android` as a dependency in your `pom.xml`: ``` -### Using a Jar - -- Download the [latest bugsnag-android.jar](https://github.com/bugsnag/bugsnag-android/releases/latest) -- Place it in your Android app's `libs/` folder - - Configuring Your AndroidManifest -------------------------------- diff --git a/build.gradle b/build.gradle index 91c0101c28..f99e86b18e 100644 --- a/build.gradle +++ b/build.gradle @@ -33,24 +33,5 @@ android { } } -// Task to generate a .jar file -task jarRelease(type: Copy) { - def jarFile = POM_ARTIFACT_ID + '-' + VERSION_NAME + '.jar' - - from 'build/intermediates/bundles/release/' - into 'build/outputs/jar' - include 'classes.jar' - rename('classes.jar', jarFile) - - artifacts.add('archives', file('build/outputs/jar/' + jarFile)); -} - -// Generate .jar files when assembling release builds -tasks.whenTaskAdded { task -> - if (task.name == 'signArchives') { - task.dependsOn jarRelease - } -} - // Tasks to release the library to maven central apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle' diff --git a/gradle.properties b/gradle.properties index d4906ad6b8..f413172530 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,7 +14,7 @@ POM_NAME=Bugsnag Android POM_DESCRIPTION=Official Bugsnag notifier for Android applications POM_URL=https://bugsnag.com POM_ARTIFACT_ID=bugsnag-android -POM_PACKAGING=jar +POM_PACKAGING=aar ANDROID_BUILD_TARGET_SDK_VERSION=19 ANDROID_BUILD_TOOLS_VERSION=21.1.1 From c8599e316f67b463653714443137791fd6c37fb8 Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Tue, 5 Jan 2016 01:56:22 +0100 Subject: [PATCH 2/5] let the library declare and export its own permissions fix bugsnag/bugsnag-android#50 --- README.md | 5 ++--- example/src/main/AndroidManifest.xml | 1 - src/androidTest/AndroidManifest.xml | 1 - src/main/AndroidManifest.xml | 5 ++++- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e3e34b61d8..7a019bb5d1 100644 --- a/README.md +++ b/README.md @@ -43,13 +43,12 @@ Configuring Your AndroidManifest ``` -- Enable the `INTERNET`, `ACCESS_NETWORK_STATE` and `GET_TASKS` permissions: +- Recommended: Enable the `ACCESS_NETWORK_STATE` and `GET_TASKS` permissions: ```xml - - + ``` diff --git a/example/src/main/AndroidManifest.xml b/example/src/main/AndroidManifest.xml index 5dd1cc96ee..6e59aa8010 100644 --- a/example/src/main/AndroidManifest.xml +++ b/example/src/main/AndroidManifest.xml @@ -16,7 +16,6 @@ - diff --git a/src/androidTest/AndroidManifest.xml b/src/androidTest/AndroidManifest.xml index 8a1436c9e1..9dc366aee1 100644 --- a/src/androidTest/AndroidManifest.xml +++ b/src/androidTest/AndroidManifest.xml @@ -4,7 +4,6 @@ android:versionCode="1" android:versionName="1.0" > - diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index 2a600e2bfb..31a0459b29 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -2,6 +2,9 @@ + android:versionName="1.0"> + + + From c63a3625f2320ffde76d9b15b42a3ec8a58434ff Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Tue, 5 Jan 2016 21:50:12 +0100 Subject: [PATCH 3/5] remove default proguard rules this removes all proguard rules which are already present in the default proguard config of the android-sdk --- proguard.txt | 9 --------- 1 file changed, 9 deletions(-) diff --git a/proguard.txt b/proguard.txt index 4e6a33a5e4..c596707b7e 100644 --- a/proguard.txt +++ b/proguard.txt @@ -17,15 +17,6 @@ java.lang.Class class$(java.lang.String, boolean); } --keepclasseswithmembernames class * { - native ; -} - --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - -keepclassmembers class * implements java.io.Serializable { static final long serialVersionUID; private static final java.io.ObjectStreamField[] serialPersistentFields; From 921cd36fd7f716e4673c577b6a92f7e0f7302d32 Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Tue, 5 Jan 2016 22:14:43 +0100 Subject: [PATCH 4/5] let the proguard rules only affect the com.bugsnag.** package --- proguard.txt | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/proguard.txt b/proguard.txt index c596707b7e..fb2310fe65 100644 --- a/proguard.txt +++ b/proguard.txt @@ -1,10 +1,11 @@ --dontobfuscate +-keeppackagenames com.bugsnag.** +-keepnames class com.bugsnag.** +-keepclassmembernames class com.bugsnag.** { *; } --renamesourcefileattribute SourceFile -keepattributes Exceptions,InnerClasses,Signature,Deprecated, SourceFile,LineNumberTable,*Annotation*,EnclosingMethod --keep public class * { +-keep public class com.bugsnag.** { public protected *; } @@ -12,12 +13,7 @@ static void run(java.lang.Runnable); } --keepclassmembernames class * { - java.lang.Class class$(java.lang.String); - java.lang.Class class$(java.lang.String, boolean); -} - --keepclassmembers class * implements java.io.Serializable { +-keepclassmembers class com.bugsnag.** implements java.io.Serializable { static final long serialVersionUID; private static final java.io.ObjectStreamField[] serialPersistentFields; private void writeObject(java.io.ObjectOutputStream); From 047160c2f8272db847faf5b10dd1f8c1396572ce Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Tue, 5 Jan 2016 22:45:19 +0100 Subject: [PATCH 5/5] let the library ship its own proguard rules see also: http://google.github.io/android-gradle-dsl/1.5/com.android.build.gradle.internal.dsl.ProductFlavor.html#com.android.build.gradle.internal.dsl.ProductFlavor:consumerProguardFiles --- build.gradle | 8 +------- example/build.gradle | 4 +--- example/proguard.pro | 19 +++++++++++++++++-- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/build.gradle b/build.gradle index f99e86b18e..ce4bf39612 100644 --- a/build.gradle +++ b/build.gradle @@ -19,13 +19,7 @@ android { defaultConfig { minSdkVersion 4 targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION) - } - - buildTypes { - release { - minifyEnabled true - proguardFile 'proguard.txt' - } + consumerProguardFiles 'proguard.txt' } lintOptions { diff --git a/example/build.gradle b/example/build.gradle index 27a2648d14..4c2841e5f8 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -16,14 +16,12 @@ android { buildTypes { debug { - minifyEnabled true - proguardFile 'proguard.pro' applicationIdSuffix ".debug" } release { minifyEnabled true - proguardFile 'proguard.pro' + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.pro' } } diff --git a/example/proguard.pro b/example/proguard.pro index 8d6bb14c81..c550f04d00 100644 --- a/example/proguard.pro +++ b/example/proguard.pro @@ -1,2 +1,17 @@ --keepattributes LineNumberTable,SourceFile --dontoptimize +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#}