Reputation: 36
I am making an app I plan to release on iPhone and Android in this coming year. I have been trying to switch the code onto my new Mac and on Android Studio Ladybug, but no matter what I do, I cannot get the project to run without throwing errors on my m1 Mac. I would like it to be on my Mac so I can 'code on the go'. I have tried using Chatgpt to help fix errors, but it brings me in circles and never helps me fix anything.
The current issue I am facing is when I run 'flutter pub get' .... (OS Error: File name too long, errno = 63) Failed to update packages. but I can go through my ~ .zshrc file and there are no duplicates. Does anyone have any pointers! Thanks!
But when actually running the flutter application I get
FAILURE: Build failed with an exception.
BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 65
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
BUILD FAILED in 3s
I have tried making sure my gradle and java were compatible versions, as well as spending 8 hours total trying to fix the issues, but to no avail.
my ~ .zshrc file looks like this:
export JAVA_HOME=$(/usr/libexec/java_home -v 23)
export PATH=$JAVA_HOME/bin:$PATH
# Remove repeated entries
export PATH="$HOME/development/flutter/bin:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$PATH"
export FLUTTER_ROOT="$HOME/development/flutter"
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH="$HOME/.rbenv/bin:$PATH"
export PATH="/opt/homebrew/opt/ruby/bin:$PATH"
export GEM_HOME=$HOME/.gem
export PATH="$GEM_HOME/bin:$PATH"
setopt hist_ignore_all_dups
My android/build.gradle looks like this:
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
// Android Gradle Plugin - Update to a compatible version
classpath 'com.android.tools.build:gradle:8.1.2'
// Google Services Plugin - Adjust to latest stable version
classpath 'com.google.gms:google-services:4.3.15'
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
// Set root project build directory
rootProject.buildDir = '../build'
// Configure subproject build directories
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
// Clean task
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
And my android/settings.gradle looks like this:
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.10" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
id 'com.google.gms.google-services' version '4.3.0' apply false
}
include ':app'
Upvotes: 0
Views: 85
Reputation: 36
Turns out the problem was a multitude of things.
Poor file structure, Look through all your files and make sure they are in the right location(ie. no duplicates or main.dart in your Android folder)
Update all dependencies
Log all errors and fix one error at a time.
Make sure Firebase initialization/plugins are not causing compiling errors!
If all is done, the application should now work and run on Android Studio Ladybug on Mac or Windows
Upvotes: 0
Reputation: 27
Consider upgrading your Windows version of Android Studio to the latest "Ladybug" release. After that, open the Android section of your Flutter project in a new window. Allow Android Studio to build your project. Once the build is complete, transfer your project to your Mac. Even if you encounter errors during building the project, having the Android part open in a separate window will provide you with more detailed error descriptions, making it easier to troubleshoot
Upvotes: 1