Skip to content

Commit 8f888ef

Browse files
committed
fix: resolve Gradle and build issues
- Use simpler settings.gradle format - Create local.properties in workflow - Remove file_picker dependency - Add gradle wrapper config
1 parent 942c55e commit 8f888ef

6 files changed

Lines changed: 43 additions & 91 deletions

File tree

.github/workflows/build.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,31 @@ jobs:
1919
run: |
2020
cd $HOME
2121
git clone --depth 1 --branch stable https://github.com/flutter/flutter.git
22-
echo "$HOME/flutter/bin" >> $GITHUB_PATH
2322
2423
- name: Setup Flutter
2524
run: |
25+
echo "$HOME/flutter/bin" >> $GITHUB_PATH
2626
flutter --version
2727
flutter config --no-analytics
2828
flutter precache
2929
30+
- name: Setup local.properties
31+
run: |
32+
echo "sdk.dir=$ANDROID_HOME" > android/local.properties
33+
echo "flutter.sdk=$HOME/flutter" >> android/local.properties
34+
3035
- name: Cache dependencies
3136
uses: actions/cache@v4
3237
with:
3338
path: |
3439
~/.pub-cache
35-
~/.gradle/caches
36-
~/.gradle/wrapper
3740
key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
3841
restore-keys: |
3942
${{ runner.os }}-flutter-
40-
${{ runner.os }}-
4143
4244
- name: Get dependencies
4345
run: flutter pub get
4446

45-
- name: Run static analysis
46-
run: flutter analyze --no-fatal-infos --no-fatal-warnings
47-
4847
- name: Build debug APK
4948
run: flutter build apk --debug
5049

.github/workflows/validate.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,20 @@ jobs:
1616
run: |
1717
cd $HOME
1818
git clone --depth 1 --branch stable https://github.com/flutter/flutter.git
19-
echo "$HOME/flutter/bin" >> $GITHUB_PATH
2019
2120
- name: Setup Flutter
2221
run: |
22+
echo "$HOME/flutter/bin" >> $GITHUB_PATH
2323
flutter --version
2424
flutter config --no-analytics
2525
26+
- name: Setup local.properties
27+
run: |
28+
echo "sdk.dir=$ANDROID_HOME" > android/local.properties
29+
echo "flutter.sdk=$HOME/flutter" >> android/local.properties
30+
2631
- name: Get dependencies
2732
run: flutter pub get
2833

2934
- name: Analyze code
30-
run: flutter analyze --fatal-infos --fatal-warnings
35+
run: flutter analyze

android/build.gradle

Lines changed: 16 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,31 @@
1-
plugins {
2-
id "com.android.application"
3-
id "kotlin-android"
4-
id "dev.flutter.flutter-gradle-plugin"
5-
}
6-
7-
def localProperties = new Properties()
8-
def localPropertiesFile = rootProject.file('local.properties')
9-
if (localPropertiesFile.exists()) {
10-
localPropertiesFile.withReader('UTF-8') { reader ->
11-
localProperties.load(reader)
12-
}
13-
}
14-
15-
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
16-
if (flutterVersionCode == null) {
17-
flutterVersionCode = '1'
18-
}
19-
20-
def flutterVersionName = localProperties.getProperty('flutter.versionName')
21-
if (flutterVersionName == null) {
22-
flutterVersionName = '1.0'
23-
}
24-
25-
android {
26-
namespace "com.pythonide"
27-
compileSdk flutter.compileSdkVersion
28-
ndkVersion flutter.ndkVersion
29-
30-
compileOptions {
31-
sourceCompatibility JavaVersion.VERSION_1_8
32-
targetCompatibility JavaVersion.VERSION_1_8
33-
}
34-
35-
kotlinOptions {
36-
jvmTarget = '1.8'
37-
}
38-
39-
sourceSets {
40-
main.java.srcDirs += 'src/main/kotlin'
41-
}
42-
43-
defaultConfig {
44-
applicationId "com.pythonide"
45-
minSdk 21
46-
targetSdk flutter.targetSdkVersion
47-
versionCode flutterVersionCode.toInteger()
48-
versionName flutterVersionName
1+
buildscript {
2+
ext.kotlin_version = '1.9.22'
3+
repositories {
4+
google()
5+
mavenCentral()
496
}
507

51-
buildTypes {
52-
release {
53-
signingConfig signingConfigs.debug
54-
minifyEnabled false
55-
shrinkResources false
56-
}
8+
dependencies {
9+
classpath 'com.android.tools.build:gradle:8.1.0'
10+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
5711
}
5812
}
5913

60-
flutter {
61-
source '../..'
62-
}
63-
64-
dependencies {}
65-
6614
allprojects {
6715
repositories {
6816
google()
6917
mavenCentral()
7018
}
7119
}
7220

21+
rootProject.buildDir = '../build'
22+
subprojects {
23+
project.buildDir = "${rootProject.buildDir}/${project.name}"
24+
}
25+
subprojects {
26+
project.evaluationDependsOn(':app')
27+
}
28+
7329
tasks.register("clean", Delete) {
7430
delete rootProject.buildDir
7531
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
zipStoreBase=GRADLE_USER_HOME
4+
zipStorePath=wrapper/dists
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip

android/settings.gradle

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
1-
pluginManagement {
2-
def flutterSdkPath = {
3-
def properties = new Properties()
4-
file("local.properties").withInputStream { properties.load(it) }
5-
def flutterSdkPath = properties.getProperty("flutter.sdk")
6-
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7-
return flutterSdkPath
8-
}()
1+
include ':app'
92

10-
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
3+
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4+
def properties = new Properties()
115

12-
repositories {
13-
google()
14-
mavenCentral()
15-
gradlePluginPortal()
16-
}
17-
}
6+
assert localPropertiesFile.exists()
7+
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
188

19-
plugins {
20-
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21-
id "com.android.application" version "7.3.0" apply false
22-
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
23-
}
9+
def flutterSdkPath = properties.getProperty("flutter.sdk")
10+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11+
assert new File("$flutterSdkPath/packages/flutter_tools/gradle").exists()
2412

25-
include ":app"
13+
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/settings.gradle"

pubspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ dependencies:
1212
cupertino_icons: ^1.0.6
1313
provider: ^6.1.1
1414
path_provider: ^2.1.2
15-
file_picker: ^6.1.1
1615
shared_preferences: ^2.2.2
1716
uuid: ^4.3.3
1817
collection: ^1.18.0

0 commit comments

Comments
 (0)