Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions android/src/main/java/com/crazecoder/openfile/OpenFilePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,6 @@ public class OpenFilePlugin implements MethodCallHandler
private static final int RESULT_CODE = 0x12;
private static final String TYPE_STRING_APK = "application/vnd.android.package-archive";

@Deprecated
public static void registerWith(PluginRegistry.Registrar registrar) {
OpenFilePlugin plugin = new OpenFilePlugin();
plugin.activity = registrar.activity();
plugin.context = registrar.context();
plugin.channel = new MethodChannel(registrar.messenger(), "open_file");
plugin.channel.setMethodCallHandler(plugin);
registrar.addRequestPermissionsResultListener(plugin);
registrar.addActivityResultListener(plugin);
}

private boolean hasPermission(String permission) {
return ContextCompat.checkSelfPermission(activity, permission) == PermissionChecker.PERMISSION_GRANTED;
}
Expand Down
25 changes: 10 additions & 15 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
Expand All @@ -6,10 +12,6 @@ if (localPropertiesFile.exists()) {
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
Expand All @@ -21,13 +23,10 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 34
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
namespace "com.example.example"

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -48,7 +47,7 @@ android {
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion 34
compileSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand All @@ -64,8 +63,4 @@ android {

flutter {
source '../..'
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
}
17 changes: 1 addition & 16 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
buildscript {
ext.kotlin_version = '1.6.21'
repositories {
google()
mavenCentral()
maven { url "https://maven.google.com" }
}

dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
mavenCentral()
maven { url "https://maven.google.com" }
}
}

Expand All @@ -30,4 +15,4 @@ subprojects {

tasks.register("clean", Delete) {
delete rootProject.buildDir
}
}
4 changes: 2 additions & 2 deletions example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Jun 23 08:50:38 CEST 2017
#Fri Mar 07 07:40:16 PKT 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
30 changes: 22 additions & 8 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
include ':app'
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.5.0" apply false
id "org.jetbrains.kotlin.android" version "2.0.10" apply false
}

include ":app"
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies:
sdk: flutter
open_filex:
path: ../
permission_handler: ^10.3.0
permission_handler: ^11.4.0

dev_dependencies:
flutter_test:
Expand Down