-
-
Notifications
You must be signed in to change notification settings - Fork 435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New sample with min api level #2117
Changes from 6 commits
9f3eac4
3a87193
9268b77
86510e2
1709d3f
d587a72
f050a46
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import com.android.build.api.dsl.Lint | ||
import net.ltgt.gradle.errorprone.errorprone | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
|
@@ -8,6 +9,7 @@ plugins { | |
id(Config.QualityPlugins.errorProne) | ||
id(Config.QualityPlugins.gradleVersions) | ||
id(Config.BuildPlugins.buildConfig) version Config.BuildPlugins.buildConfigVersion | ||
id(Config.QualityPlugins.androidLint) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Java projects can add the Android lint but I could not find a way to configure it using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apollo is also available for non Android, not sure how we would add it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @adinauer what do you mean? This is the Apollo module and I'm adding the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes I was trying to say that we probably can't just add the android plugin to it to gain There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah gotcha, that's not the problem, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we simply run grep on the logs instead and check for minApi warnings? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But which logs do you want to run grep on? You need to be able to run lint first :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought it works but we can't customize it to fail the build for minSdk violations. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the Linter runs already, but it does not check for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://github.com/open-toast/gummy-bears |
||
} | ||
|
||
configure<JavaPluginExtension> { | ||
|
@@ -20,6 +22,16 @@ tasks.withType<KotlinCompile>().configureEach { | |
kotlinOptions.languageVersion = Config.kotlinCompatibleLanguageVersion | ||
} | ||
|
||
configure<Lint> { | ||
warningsAsErrors = true | ||
checkDependencies = true | ||
|
||
// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks. | ||
checkReleaseBuilds = false | ||
disable.addAll(listOf("TrulyRandom")) | ||
checkAllWarnings = true | ||
} | ||
|
||
dependencies { | ||
api(projects.sentry) | ||
api(projects.sentryKotlinExtensions) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
plugins { | ||
id("com.android.application") | ||
kotlin("android") | ||
} | ||
|
||
android { | ||
compileSdk = Config.Android.compileSdkVersion | ||
|
||
defaultConfig { | ||
applicationId = "io.sentry.samples.android.minsdk" | ||
minSdk = Config.Android.minSdkVersion | ||
targetSdk = Config.Android.targetSdkVersion | ||
versionCode = 2 | ||
versionName = "1.1.0" | ||
} | ||
|
||
buildFeatures { | ||
// Determines whether to support View Binding. | ||
// Note that the viewBinding.enabled property is now deprecated. | ||
viewBinding = true | ||
} | ||
|
||
dependenciesInfo { | ||
// Disables dependency metadata when building APKs. | ||
includeInApk = false | ||
// Disables dependency metadata when building Android App Bundles. | ||
includeInBundle = false | ||
} | ||
|
||
signingConfigs { | ||
getByName("debug") { | ||
storeFile = rootProject.file("debug.keystore") | ||
storePassword = "android" | ||
keyAlias = "androiddebugkey" | ||
keyPassword = "android" | ||
} | ||
} | ||
|
||
buildTypes { | ||
getByName("debug") { | ||
addManifestPlaceholders( | ||
mapOf( | ||
"sentryDebug" to true | ||
) | ||
) | ||
} | ||
getByName("release") { | ||
isMinifyEnabled = true | ||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") | ||
signingConfig = signingConfigs.getByName("debug") // to be able to run release mode | ||
isShrinkResources = true | ||
|
||
addManifestPlaceholders( | ||
mapOf( | ||
"sentryDebug" to false | ||
) | ||
) | ||
} | ||
} | ||
|
||
kotlinOptions { | ||
jvmTarget = JavaVersion.VERSION_1_8.toString() | ||
} | ||
|
||
variantFilter { | ||
if (Config.Android.shouldSkipDebugVariant(buildType.name)) { | ||
ignore = true | ||
} | ||
} | ||
|
||
lint { | ||
warningsAsErrors = true | ||
checkDependencies = true | ||
|
||
// We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks. | ||
checkReleaseBuilds = false | ||
disable += "TrulyRandom" | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) | ||
|
||
implementation(projects.sentryAndroid) | ||
implementation(projects.sentryAndroidFragment) | ||
implementation(projects.sentryAndroidTimber) | ||
implementation(projects.sentryApollo) | ||
Comment on lines
+85
to
+88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So all projects with lower API is here |
||
|
||
implementation(Config.Libs.appCompat) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# 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 *; | ||
#} | ||
|
||
# To ensure that stack traces is unambiguous | ||
# https://developer.android.com/studio/build/shrink-code#decode-stack-trace | ||
-keepattributes LineNumberTable,SourceFile | ||
|
||
|
||
# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native | ||
-keepclasseswithmembernames,includedescriptorclasses class * { | ||
native <methods>; | ||
} | ||
|
||
# Please add these rules to your existing keep rules in order to suppress warnings. | ||
# This is generated automatically by the Android Gradle plugin. | ||
-dontwarn org.bouncycastle.jsse.BCSSLParameters | ||
-dontwarn org.bouncycastle.jsse.BCSSLSocket | ||
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider | ||
-dontwarn org.conscrypt.Conscrypt$Version | ||
-dontwarn org.conscrypt.Conscrypt | ||
-dontwarn org.conscrypt.ConscryptHostnameVerifier | ||
-dontwarn org.openjsse.javax.net.ssl.SSLParameters | ||
-dontwarn org.openjsse.javax.net.ssl.SSLSocket | ||
-dontwarn org.openjsse.net.ssl.OpenJSSE |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="io.sentry.samples.android.minsdk"> | ||
|
||
<!-- extra recommended permission, we'd be able to check network status--> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
|
||
<!-- add extra permission (optional) --> | ||
<!-- extra recommended permission, we'd be able to collect device ringing breadcrumbs (PhoneStateBreadcrumbsIntegration) --> | ||
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> | ||
|
||
<!-- if your minSdkVersion < 16, this would make usable on minSdkVersion >= 14--> | ||
<uses-sdk | ||
tools:overrideLibrary="io.sentry.android"/> | ||
|
||
<application | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:theme="@style/AppTheme" | ||
tools:ignore="GoogleAppIndexingWarning, UnusedAttribute"> | ||
|
||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<!-- NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry project/dashboard--> | ||
<meta-data android:name="io.sentry.dsn" android:value="https://[email protected]/5428559" /> | ||
|
||
<!-- how to enable Sentry's debug mode--> | ||
<meta-data android:name="io.sentry.debug" android:value="${sentryDebug}" /> | ||
|
||
</application> | ||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package io.sentry.samples.android.minsdk; | ||
|
||
import android.os.Bundle; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
import io.sentry.samples.android.minsdk.databinding.ActivityMainBinding; | ||
|
||
public class MainActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
final ActivityMainBinding binding = ActivityMainBinding.inflate(getLayoutInflater()); | ||
|
||
setContentView(binding.getRoot()); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:aapt="http://schemas.android.com/aapt" | ||
android:width="108dp" | ||
android:height="108dp" | ||
android:viewportWidth="108" | ||
android:viewportHeight="108"> | ||
<path | ||
android:fillType="evenOdd" | ||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z" | ||
android:strokeWidth="1" | ||
android:strokeColor="#00000000"> | ||
<aapt:attr name="android:fillColor"> | ||
<gradient | ||
android:endX="78.5885" | ||
android:endY="90.9159" | ||
android:startX="48.7653" | ||
android:startY="61.0927" | ||
android:type="linear"> | ||
<item | ||
android:color="#44000000" | ||
android:offset="0.0" /> | ||
<item | ||
android:color="#00000000" | ||
android:offset="1.0" /> | ||
</gradient> | ||
</aapt:attr> | ||
</path> | ||
<path | ||
android:fillColor="#FFFFFF" | ||
android:fillType="nonZero" | ||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z" | ||
android:strokeWidth="1" | ||
android:strokeColor="#00000000" /> | ||
</vector> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert before merging