1 Development Environment
Your work will be evaluated on a machine with the following setup.
-
OS: Windows 10.
-
Android Studio: Ladybug v2024.2.1 Patch 2.
-
Visual Studio Code: v1.95.3
-
Flutter SDK: v3.24.5 stable.
-
XAMPP: v8.2.12.
2 Files
Some students faced difficulties with Gradle in Visual Studio Code. The following is a listing of the files as they appear in my machine.
2.1 settings.gradle
// This file is located in <flutter_project>\android\settings.gradle
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
}()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
//id "com.android.application" version "8.1.0" apply false
//id "org.jetbrains.kotlin.android" version "1.8.22" apply false
id "com.android.application" version "8.3.2" apply false
id "org.jetbrains.kotlin.android" version "2.0.20" apply false
}
include ":app"
2.2 build.gradle
// This file is located in <flutter_project>\android\app\build.gradle
plugins {
id "com.android.application"
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
}
android {
namespace = "com.example.flutter_empty_01"
compileSdk = flutter.compileSdkVersion
//ndkVersion = flutter.ndkVersion
ndkVersion = "25.1.8937393"
/*compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_7
}*/
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = 17
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.flutter_empty_01"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}
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
}
}
}
flutter {
source = "../.."
}
2.3 gradle-wrapper.properties
# This file is located in <flutter_project>\android\gradle\wrapper\gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
3 Setting Up MySQL
-
Go to
localhost/phpmyadmin. -
Create a new database
dm_final_project. -
In the
SQLtab to the right, input your SQL commands to create tables and populate them, and press Go. -
In the
Privilegestab, create a new user and give him all possible privileges. This is wrong in general, however, for this project, do it to get rid of any potential database access issues. Choose a username and a password. Leave everything else as is. -
In
config.php, make sure you use the correct database name, username, and password. -
In a command-prompt, run
ipconfigand get your local IP address e.g.192.168.1.10. -
Change the line
final String baseUrl = "http://192.168.1.8/course_app";indatabase_helper.darttofinal String baseUrl = "http://192.168.1.10/dm_final_project";. Notice that I have removed the/appsbecause this refers to the position of the folder in my Linux server.