Как устранить ошибку, возникающую в app/build.gradle или project/build.gradleJAVA

Программисты JAVA общаются здесь
Ответить Пред. темаСлед. тема
Anonymous
 Как устранить ошибку, возникающую в app/build.gradle или project/build.gradle

Сообщение Anonymous »

app/build.gradle

Код: Выделить всё

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
}
project/build.gradle

Код: Выделить всё

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).
Я получал сообщение об ошибке, сообщающее, что в разделе Android что-то не так с файлом Android Manifest.xml, и мне нужно перенести весь код, файл pubspec.yaml и интегрировать все зависимости и плагины как в файлах градиентов на уровне приложения, так и на уровне проекта, а также поместить

Код: Выделить всё

google-services.json
согласно инструкциям Firebase
итак,
я перенес код во вновь созданное приложение и при запуске проекта появилась эта ошибка, я попытался устранить ее через ChatGPT, но ничего не получилось. Эти файлы градиентов копируются из приглашения ChatGPT, но они все еще не работают. Приложение успешно работает в Интернете, но не на Android.

Подробнее здесь: https://stackoverflow.com/questions/786 ... ild-gradle
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «JAVA»