Skip to content

Commit

Permalink
Upgrade target SDK to 34 (Android 14), upgrade Gradle and AGP
Browse files Browse the repository at this point in the history
  • Loading branch information
Manicben committed Feb 25, 2024
1 parent 1c94dc9 commit 12a90ee
Show file tree
Hide file tree
Showing 11 changed files with 200 additions and 201 deletions.
9 changes: 6 additions & 3 deletions PhysicaloidLibrary/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.manicben.physicaloid"
android:versionCode="10000"
android:versionName="01.00.00" >

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
<uses-permission android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30"/>
</manifest>
77 changes: 18 additions & 59 deletions PhysicaloidLibrary/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ repositories {
maven { url 'https://jitpack.io' }
}

group = 'com.manicben'
version = '1.0.0'

android {
compileSdkVersion 30
namespace "com.manicben.physicaloid"

compileSdk 34

defaultConfig {
minSdkVersion 12
targetSdkVersion 30
versionCode 1
versionName "1.0"
targetSdkVersion 34
}

buildFeatures {
buildConfig true
}

buildTypes {
Expand All @@ -29,9 +30,16 @@ android {
}
}

publishing {
singleVariant('release') {
withSourcesJar()
withJavadocJar()
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

sourceSets {
Expand All @@ -47,65 +55,16 @@ dependencies {
implementation('com.google.guava:guava:30.1.1-android')
}

// Build a jar with source files
task sourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs

preserveFileTimestamps = false
reproducibleFileOrder = true
}

task javadoc(type: Javadoc) {
failOnError = false
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
android.libraryVariants.all { variant ->
if (variant.name == 'release') {
owner.classpath += variant.javaCompileProvider.get().classpath
}
}

exclude "**/R**"
exclude "**/BuildConfig*"

options.encoding 'utf-8'
options {
addStringOption 'docencoding', 'utf-8'
addStringOption 'charset', 'utf-8'
links 'https://docs.oracle.com/javase/7/docs/api/'
links 'https://d.android.com/reference'
links 'https://developer.android.com/reference/androidx/'
}
}

// Build a jar with javadoc
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
from javadoc.destinationDir

preserveFileTimestamps = false
reproducibleFileOrder = true
}

afterEvaluate {
// fixes issue where javadoc can't find android symbols ref: http://stackoverflow.com/a/34572606
javadoc.classpath += files(android.libraryVariants.collect { variant ->
variant.javaCompileProvider.get().classpath.files
})

publishing {
publications {
// Creates a Maven publication called "release".
release(MavenPublication) {
from components.release

artifact sourcesJar
artifact javadocJar

groupId = 'com.manicben'
artifactId = 'PhysicaloidLibrary'
version = '1.0.0'
version = '1.1.0'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,7 @@ public void init(Context context) {
}

if(mPermissionIntent == null) {
if(android.os.Build.VERSION.SDK_INT >= 31) {
mPermissionIntent = PendingIntent.getBroadcast(context, 0, new Intent("USB_PERMISSION"), PendingIntent.FLAG_IMMUTABLE);
} else {
mPermissionIntent = PendingIntent.getBroadcast(context, 0, new Intent("USB_PERMISSION"), 0);
}
mPermissionIntent = PendingIntent.getBroadcast(context, 0, new Intent("USB_PERMISSION"), PendingIntent.FLAG_IMMUTABLE);
}
}

Expand Down
5 changes: 2 additions & 3 deletions SampleProjects/PhysicaloidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.manicben.physicaloidtest"
android:versionCode="1"
android:versionName="1.0" >

Expand All @@ -11,8 +10,8 @@
android:label="@string/app_name"
android:theme="@style/AppTheme">
<activity
android:name=".PhysicaloidTestActivity"
android:label="@string/app_name" >
android:name="com.manicben.physicaloidtest.PhysicaloidTestActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
7 changes: 5 additions & 2 deletions SampleProjects/PhysicaloidTest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ dependencies {
}

android {
compileSdkVersion 30
namespace 'com.manicben.physicaloidtest'

compileSdk 33

defaultConfig {
applicationId 'com.manicben.physicaloidtest'
minSdkVersion 12
targetSdkVersion 30
targetSdkVersion 33
}

sourceSets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".PhysicaloidTestActivity" >
tools:context="com.manicben.physicaloidtest.PhysicaloidTestActivity" >

<Button
android:id="@+id/btOpen"
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'com.android.tools.build:gradle:8.2.1'
}
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
11 changes: 5 additions & 6 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Sun Sep 05 17:23:02 BST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 12a90ee

Please sign in to comment.