No signature of method: build_cxg6xj9c5whzgudsd0od94tfb.android() - flutter

I am trying to use "camera_deep_ar: ^0.0.2+3" this package and have added dependency, permission and proguard-rules.pro file in android\app directory. but getting below error.
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\temporery1\android\app\build.gradle' line: 29
* What went wrong:
A problem occurred evaluating project ':app'.
> No signature of method: build_cxg6xj9c5whzgudsd0od94tfb.android() is applicable for argument
types: (build_cxg6xj9c5whzgudsd0od94tfb$_run_closure2) values:
[build_cxg6xj9c5whzgudsd0od94tfb$_run_closure2#28654672]
* 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 2s
Exception: Gradle task assembleDebug failed with exit code 1
My app/build.gradle code is:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion flutter.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
androidResources {
noCompress '...'
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.temporery2"
minSdkVersion 19
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
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
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
minifyEnabled true
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
Please guide me how i can solve this issue. from last 2 days i am trying to resolve this issue.

Related

A problem occurred evaluating project ':app' . No signature of method

Recently, I studied using firebase in a flutter project. I followed the step but also got an error.
I searched and guess it is a app\build.gradle getting a problem. But also didn't know what the problem is.
No signature of method: build_5viubdggwtiixi0imz59oppqn.android() is applicable for argument types: (build_5viubdggwtiixi0imz59oppqn$_run_closure2) values: [build_5viubdggwtiixi0imz59oppqn$_run_closure2#71088475]
Here are the "relevant codes and error:
Error:
FAILURE: Build failed with an exception.
* Where:
Build file 'E:\firebase\android\app\build.gradle' line: 29
* What went wrong:
A problem occurred evaluating project ':app'.
> No signature of method: build_5viubdggwtiixi0imz59oppqn.android() is applicable for argument types: (build_5viubdggwtiixi0imz59oppqn$_run_closure2) values: [build_5viubdggwtiixi0imz59oppqn$_run_closure2#71088475]
* 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 1s
Exception: Gradle task assembleDebug failed with exit code 1
Code:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.getx.app.db.firebaseApp"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
MultiDexEnable true
}
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 '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:multidex:1.0.3'
}
#lousea, We get such kind of error when we use any undefined attribute in the gradle file.
In your case, in the default config, you have misspelled the multidex attribute. Just change MultiDexEnable to multiDexEnabled then it will work properly.
or just replace the defaultConfig from below
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.getx.app.db.firebaseApp"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}

ERROR: Task failed with an exception build.gradle' line: 25

I have seen many similar questions, but none of the solutions fixed my problem. I get the following error on vscode.
Where: Build file 'E:\Download\Chatter-App-master\Chatter-App-master\android\app\build.gradle'
line: 25
What went wrong: A problem occurred evaluating project ':app'.
Plugin with id 'kotlin-android' not found
.
here the build gradle code
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.myfirst_flultter_project"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 19
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
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 '../..'
}
dependencies {
implementation 'com.google.firebase:firebase-analytics'
implementation platform('com.google.firebase:firebase-bom:30.2.0')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:multidex:2.0.1'
}

Execution failed for task ':app:processDebugMainManifest'. VS code

I'm new to flutter and am trying to run a new project on VS code.
installed the latest flutter at 19/1/2022. flutter --version gives me 2.8.1.
jdk is 17.0.1
this is what i get ...
Launching lib\main.dart on SM N975F in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings generic class cache for settings file 'G:\1-programing\Projects\Flutter\flutter_application_2\android\settings.gradle' (C:\Users\username\.gradle\caches\6.7\scripts\1fnwrr8g4rohfp291nvlxj5qe).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61
* 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 1s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
tried to change gradle, which is 6.7 in gradle-wrapper.properties, to 7.3.3 which is the latest.
and this is what i get...
Launching lib\main.dart on SM N975F in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module #30206a4d
* 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 3s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
i have tried changing the build.gradle in android/app/src
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.flutter_application_2"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
to
defaultConfig {
applicationId "com.example.gfgpagination"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
and it was not helpfull.
have tried searching these errors but i could not use them to this day.
my build.gradle in android folder
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and my build.gradle in android/app folder
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion flutter.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.flutter_application_2"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
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 '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
soooo, I am going to answer my own question.
it seems i was using the latest java SDK version.
As mentioned in the install web page, i must have downloaded java SDK8 .
that's probably everything i did to fix it.
Try this for last error 'Unable to make field private final java.lang.String java.io.File.path' : https://exerror.com/accessible-module-java-base-does-not-opens-java-io-to-unnamed-module/
In your Manifest.xml add below line if it is not present:
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="31" />
For more further information you will visit below link
Stack Overflow Answer

Execution failed for task ':simple_edge_detection:externalNativeBuildDebug'

i am using simple_edge_detection library from here :
https://www.flutterclutter.dev/flutter/tutorials/implementing-edge-detection-in-flutter/2020/1509/
CMakeLists.txt
cmake_minimum_required(VERSION 3.4.1)
include_directories(../include)
add_library(lib_opencv SHARED IMPORTED)
set_target_properties(lib_opencv PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libopencv_java4.so)
set(EDGE_DETECTION_DIR "../ios/Classes")
set(SOURCES
${EDGE_DETECTION_DIR}/native_edge_detection.cpp
${EDGE_DETECTION_DIR}/edge_detector.cpp
${EDGE_DETECTION_DIR}/image_processor.cpp
)
add_library(native_edge_detection SHARED ${SOURCES})
target_link_libraries(native_edge_detection lib_opencv)
build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
// flavorDimensions "default"
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "dev.flutterclutter.simple_edge_detection_example"
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
externalNativeBuild {
cmake {
cppFlags '-frtti -fexceptions -std=c++11'
arguments "-DANDROID_STL=c++_shared"
}
}
}
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
}
}
externalNativeBuild {
cmake {
path "D:/Flutter Projects/flutter-simple-edge-detection/example/android/CMakeLists.txt"
}
}
}
but m getting this error :
FAILURE: Build failed with an exception.
Execution failed for task ':simple_edge_detection:externalNativeBuildDebug'.
Build command failed.
Error while executing process C:\Users\Andorid\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {--build D:\Flutter Projects\flutter-simple-edge-detection\android.cxx\cmake\debug\armeabi-v7a --target native_edge_detection}
ninja: error: '../../../../src/main/jniLibs/armeabi-v7a/libopencv_java4.so', needed by 'D:/Flutter Projects/flutter-simple-edge-detection/example/build/simple_edge_detection/intermediates/cmake/debug/obj/armeabi-v7a/libnative_edge_detection.so', missing and no known rule to make it

java.util.zip.ZipException: duplicate entry: com/facebook/AccessToken$1.class

When I add facebook sdk dependencies to my android studio project, I have faced the issue :
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/facebook/AccessToken$1.class
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Please help me to resolve this issue .
Here is my build.gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "24.0.1"
aaptOptions {
cruncherEnabled = false
}
defaultConfig {
applicationId "com.HN.xxx"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:support-v4:25'
compile ('com.facebook.android:facebook-android-sdk:4.+') {
exclude module: 'support-v4'
}
}
apply plugin: 'com.google.gms.google-services'