Skip to content

Commit

Permalink
Merge pull request #117 from square/artem/targetSDK24_android_only
Browse files Browse the repository at this point in the history
- Update target SDK to 34
  • Loading branch information
Armaxis authored Aug 28, 2024
2 parents 7b1cd0a + 8bf92a1 commit 93d8fc1
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 50 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/setup-java@v3
with:
java-version: '12.x'
java-version: '17'
distribution: 'temurin'
- uses: subosito/flutter-action@v1
with:
channel: 'stable' # or: 'beta', 'dev' or 'master'
Expand Down
14 changes: 7 additions & 7 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ version '2.0-SNAPSHOT'
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.android.tools.build:gradle:8.5.2'
}
}

rootProject.allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven {
url "https://sdk.squareup.com/android"
credentials {
Expand All @@ -44,14 +44,14 @@ rootProject.allprojects {
apply plugin: 'com.android.library'

def DEFAULT_PLAY_SERVICES_BASE_VERSION = '16.0.1'
def READER_SDK_VERSION = '[1.7.5, 2.0)'
def READER_SDK_VERSION = '1.7.5'

android {
compileSdkVersion 32

compileSdkVersion 34
namespace 'com.squareup.readersdkflutterplugin'
defaultConfig {
minSdkVersion 24
targetSdkVersion 31
targetSdkVersion 34
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
Expand Down
3 changes: 1 addition & 2 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.squareup.readersdkflutterplugin">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

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

Expand Down
41 changes: 29 additions & 12 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,9 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'kotlin-android'

android {
compileSdkVersion 33

lintOptions {
disable 'InvalidPackage'
checkReleaseBuilds false
}
compileSdkVersion 33
ndkVersion = "21.4.7075529"
namespace 'com.example.flutter.squareup.sdk.reader'
compileSdkVersion 34
ndkVersion = "26.1.10909125"

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -43,30 +38,52 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.flutter.squareup.sdk.reader"
minSdkVersion 26
targetSdkVersion 33
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = "1.8"
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
minifyEnabled false
shrinkResources false }
}

packagingOptions {
exclude("META-INF/*.kotlin_module")
resources {
excludes += ['META-INF/*.kotlin_module']
}
}


dexOptions {
preDexLibraries true
jumboMode true
keepRuntimeAnnotatedClasses false
}
lint {
checkReleaseBuilds false
disable 'InvalidPackage'
}
}

flutter {
Expand Down
8 changes: 6 additions & 2 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.flutter.squareup.sdk.reader">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<!-- The INTERNET permission is required for development. Specifically,
flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-feature
android:name="android.hardware.camera"
android:required="true" />

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


<!-- io.flutter.app.FlutterApplication is an android.app.Application that
Expand Down
11 changes: 5 additions & 6 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath 'com.android.tools.build:gradle:8.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.dipien:bye-bye-jetifier:1.2.1'
}
Expand All @@ -28,16 +28,15 @@ allprojects {
}

ext {
// Override the reader sdk version with the this parameter
// make sure the version is above min version 1.7.5
readerSdkVersion = "[1.7.5, 2.0)"
// Override the reader sdk version with this parameter
// Make sure the version is above min version 1.7.5
readerSdkVersion = "1.7.5"
}

rootProject.buildDir = '../build'

subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

Expand Down
3 changes: 3 additions & 0 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ android.enableJetifier=true

## The Application Secret from the OAuth tab in the Square Application Control Panel.
#SQUARE_READER_SDK_REPOSITORY_PASSWORD=
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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-7.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
22 changes: 11 additions & 11 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class ExampleApp extends StatelessWidget {
ThemeData _buildTheme() {
var base = ThemeData.light();
return base.copyWith(
backgroundColor: Color.fromRGBO(64, 135, 225, 1.0),
canvasColor: Colors.transparent,
scaffoldBackgroundColor: Color.fromRGBO(64, 135, 225, 1.0),
buttonTheme: ButtonThemeData(
Expand All @@ -54,15 +53,16 @@ ThemeData _buildTheme() {
),
),
textTheme: TextTheme(
button: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w600,
color: Colors.white,
),
bodyText1: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.w600,
color: Colors.white,
)),
labelLarge: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w600,
color: Colors.white,
),
bodyLarge: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.w600,
color: Colors.white,
),
),
);
}
7 changes: 3 additions & 4 deletions example/lib/screens/widgets/buttons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,10 @@ class SQRaisedButton extends StatelessWidget {
Widget build(BuildContext context) => ElevatedButton(
child: Text(text),
style: ElevatedButton.styleFrom(
primary: Color.fromRGBO(57, 114, 178, 1.0),
backgroundColor: Color.fromRGBO(57, 114, 178, 1.0),
padding: EdgeInsets.all(15.0),
onPrimary: Colors.white,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0)),
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0)),
),
onPressed: onPressed,
);
Expand Down
6 changes: 3 additions & 3 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ dependencies:
flutter:
sdk: flutter

permission_handler: ^9.2.0
barcode_scan2: ^4.2.1
permission_handler: ^10.2.0
barcode_scan2: ^4.3.3
intl: ^0.17.0
firebase_core: ^1.20.1
firebase_core: ^2.5.0

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
Expand Down

0 comments on commit 93d8fc1

Please sign in to comment.