How to fix this gradle sync issue - java

I am getting this error
ERROR: Could not find method implementation() for arguments [directory 'libs'] on project ':app'.
Open File
These are the contents of build.grade(Module : app)
//noinspection GradleCompatible
//noinspection ExpiredTargetSdkVersion
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "spoorthy.shopping"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
}
grade file(project:shopping)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}

apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.waltonbd.myapplication"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/raw'] } }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Add testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" in defaultConfig{} .Also add buildToolVersion
Also add google()
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Related

org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException:

I'm getting this error while I run the application:
org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
I'm wondering if the below "implementation" import statement of SwipeableCardStack in Gradle is the reason:
plugins {
id 'com.android.application'
}
android {
namespace 'com.example.jokesapp'
compileSdk 33
defaultConfig {
applicationId "com.example.jokesapp"
minSdk 21
targetSdk 33
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com.github.wenchaojiang:AndroidSwipeableCardStack:0.1.6'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
import org.gradle.api.initialization.resolve.RepositoriesMode
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
jcenter()
maven { url "https://jitpack.io" }
}
}
rootProject.name = "JokesApp"
include ':app'

Android Studio 2021.1.1.23 "app:debugCompileClasspath"

so guys i'm trying to launch my Android App , and that error face me.
ERROR : " Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugCompileClasspath'.
"
build.gradle(Project)
buildscript {
repositories {
google()
jcenter()
maven {url 'https://jitpack.oi'}
}
dependencies {
classpath "com.android.tools.build:gradle:7.1.3"
classpath 'com.google.gms:google-services:4.3.10'
}
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.1.3' apply false
id 'com.android.library' version '7.1.3' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(Module)
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.learn"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures{
viewBinding true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
//for support screens
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.intuit.ssp:ssp-android:1.0.6'
//Rounded imageView
implementation 'com.makeramen:roundedimageview:2.3.0'
//firebase
implementation 'com.google.firebase:firebase-messaging:23.0.3'
implementation 'com.google.firebase:firebase-firestore:24.1.1'
//MultiDex
implementation 'android.multidex:mutidex:2.0.1'
}
can any one help me.I was looking for a solution All day.
Change your 'android.multidex:mutidex:2.0.1' to 'androidx.multidex:multidex:2.0.1' like this:
dependencies {
...
//MultiDex
implementation 'androidx.multidex:multidex:2.0.1'
}

Realm Android Cannot resolve symbol 'SyncUser'

I get a "Cannot resolve symbol" error whenever I try to import the classes below.
io.realm.ObjectServerError;
io.realm.SyncCredentials;
io.realm.SyncUser;
but not when I try to import
io.realm.RealmQuery;
io.realm.RealmResults;
io.realm.Realm;
I have added
realm{
syncEnabled = true
}
in my app build.gradle but it still shows the same error.
Here is my app build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
realm{
syncEnabled = true
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.example.ktoon"
minSdkVersion 17
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
Here is my project build.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
classpath "io.realm:realm-gradle-plugin:10.0.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
What am I missing?
There was a number of breaking changes to the API in 10.0.0. Among them, SyncUser was renamed to io.realm.mongodb.User. See https://github.com/realm/realm-java/blob/master/CHANGELOG.md#1000-2020-10-15 for the full list

Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. " i tried my best but i could not resolve it.."

I'm getting this error after I update my android studio...
More than one file was found with OS independent path
'org/jsoup/nodes/entities-full.properties'
My "app Build.gradle"
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "info.androidhive.newsaggregator"
minSdkVersion 16
targetSdkVersion 28
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
//implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.facebook.android:facebook-android-sdk:4.11.0'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.mcxiaoke.volley:library-aar:1.0.0'
implementation 'org.jsoup:jsoup:1.8.3'
implementation 'com.github.siyamed:android-shape-imageview:0.9.3#aar'
implementation files('libs/gson-2.2.2.jar')
implementation files('libs/android-async-http-1.4.4.jar')
implementation('com.github.florent37:materialviewpager:1.1.3#aar') {
transitive = true
}
implementation 'com.github.clans:fab:1.6.3'
repositories {
mavenCentral()
}
implementation 'com.makeramen:roundedimageview:2.2.1'
implementation project(':library')
}
My "project build.gradle"
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
My "library Build.Gradle"
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.nineoldandroids:library:2.4.0'
}
Can anyone help me figuring out what's causing this error?
Any ideas on how to get this working? if you need more information please let me know. I am very new to this. Thank you so much in advance.

Could not get unknown property 'resolutionStrategy' for project ':app' of type org.gradle.api.Project

I was getting this error:
Error:Execution failed for task ':app:preDebugBuild'.
Android dependency 'com.android.support:appcompat-v7' has different version for the compile (25.3.1) and runtime (27.1.0) classpath. You should manually set the same version via DependencyResolution
A quick search on google showed me that I should include in my app/build.gradle:
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "25.3.1"
}
}
Now I get a new error:
Could not get unknown property 'resolutionStrategy' for project ':app' of type org.gradle.api.Project.
here is my full app/build.gradle code:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
dexOptions {
preDexLibraries = false
}
defaultConfig {
applicationId "co.test.Test"
minSdkVersion 26
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
flatDir {
dirs 'libs'
maven { url "http://dl.bintray.com/chat-sdk/chat-sdk-android" }
google()
maven { url "https://jitpack.io" }
mavenLocal()
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':library')
implementation 'co.chatsdk.chatsdk:chat-sdk-core:4.0.8'
implementation 'co.chatsdk.chatsdk:chat-sdk-ui:4.0.8'
implementation 'co.chatsdk.chatsdk:chat-sdk-firebase-adapter:4.0.8'
implementation 'co.chatsdk.chatsdk:chat-sdk-firebase-file-storage:4.0.8'
}
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "25.3.1"
}
}
apply plugin: 'com.google.gms.google-services'
my library/build.gradle:
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation files('libs/aacdecoder-android-0.8.jar')
}

Categories

Resources