Skip to content

build: bump Android minSdk to API level 24 - #12810

Closed
daniel-mader wants to merge 2 commits into
tauri-apps:devfrom
daniel-mader:build/bump-android-minsdk
Closed

build: bump Android minSdk to API level 24#12810
daniel-mader wants to merge 2 commits into
tauri-apps:devfrom
daniel-mader:build/bump-android-minsdk

Conversation

@daniel-mader

@daniel-mader daniel-mader commented Feb 25, 2025

Copy link
Copy Markdown

When building a Tauri plugin for mobile, the following lint error occurs:

/android/.tauri/tauri-api/src/main/java/app/tauri/PathPlugin.kt:37: Error: Call requires API level 24 (current min is 21): android.content.ContextWrapper#getDataDir [NewApi]
          resolvePath(invoke, activity.dataDir.absolutePath)
                                       ~~~~~~~

Since a call to dataDir would most likely panic on Android API level <24, bumping minSdk seems like the only viable option.

@daniel-mader
daniel-mader requested a review from a team as a code owner February 25, 2025 08:22
@github-actions

Copy link
Copy Markdown
Contributor

Package Changes Through edc883e

There are 8 changes which include tauri with minor, tauri-cli with minor, tauri-runtime with minor, tauri-runtime-wry with minor, tauri-utils with minor, @tauri-apps/api with minor, @tauri-apps/cli with minor, tauri-bundler with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@tauri-apps/api 2.2.0 2.3.0
tauri-utils 2.1.1 2.2.0
tauri-bundler 2.2.3 2.2.4
tauri-runtime 2.3.0 2.4.0
tauri-runtime-wry 2.3.0 2.4.0
tauri-codegen 2.0.4 2.0.5
tauri-macros 2.0.4 2.0.5
tauri-plugin 2.0.4 2.0.5
tauri-build 2.0.5 2.0.6
tauri 2.2.5 2.3.0
@tauri-apps/cli 2.2.7 2.3.0
tauri-cli 2.2.7 2.3.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@FabianLars

Copy link
Copy Markdown
Member

Since a call to dataDir would most likely panic on Android API level <24, bumping minSdk seems like the only viable option.

Not necessarily. Typically in these situations there are similar apis that work in lower api levels as well. After a quick google search it seems like there's also something like context.getApplicationInfo().dataDir though we'd have to check if that really matches the path.

lucasfernog added a commit that referenced this pull request Mar 2, 2025
`activity.applicationInfo.dataDir` returns the same value as `activity.dataDir.absolutePath`, but looks like the latter is synchronized when the app is moved (see https://developer.android.com/reference/android/content/Context#getDataDir() vs https://developer.android.com/reference/android/content/pm/ApplicationInfo#dataDir)

ref #12810
@lucasfernog

Copy link
Copy Markdown
Member

looks like we have a way to keep the sdk 21 requirement (we don't want to break that part yet) as Fabian-Lars suggested.

see #12870

@lucasfernog lucasfernog closed this Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants