Код: Выделить всё
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'
classpath 'com.google.gms:google-services:4.3.10' // Ensure this version matches your setup
}
}
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'com.google.gms.google-services' // Ensure this line is within the plugins block
id 'dev.flutter.flutter-gradle-plugin'
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register('clean', Delete) {
delete rootProject.buildDir
}
android {
compileSdkVersion 34 // Adjust as necessary
defaultConfig {
applicationId "com.example.instagram"
minSdkVersion 21 // Adjust as necessary
targetSdkVersion 34 // Adjust as necessary
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:33.1.1')
implementation 'com.google.firebase:firebase-analytics'
// Add other Firebase or dependencies as needed
}
Код: Выделить всё
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.2' // or your current Gradle version
classpath 'com.google.gms:google-services:4.3.10' // add the Google services Gradle plugin
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
Код: Выделить всё
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Hussain\applications\instagram\android\app\build.gradle' line: 36
* What went wrong:
A problem occurred evaluating project ':app'.
> Cannot add task 'clean' as a task with that name already exists.
* Try:
> 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle
> Cannot invoke method substring() on null object
* Try:
> 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.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 5s
Error: Gradle task assembleDebug failed with exit code 1
Exited (1).
Код: Выделить всё
google-services.json
итак,
я перенес код во вновь созданное приложение и при запуске проекта появилась эта ошибка, я попытался устранить ее через ChatGPT, но ничего не получилось. Эти файлы градиентов копируются из приглашения ChatGPT, но они все еще не работают. Приложение успешно работает в Интернете, но не на Android.
Подробнее здесь: https://stackoverflow.com/questions/786 ... ild-gradle