I am using the android studio version 3.1. I am working with youtube Api project. and had added some dependency in the gradle. After sysc it's shows everything oke and fresh. but when i go to run the application it show the error below. I have changed the compileSdkVersion and tried other ways to fix that.
Thanks in advance.
Error
org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':app:compileDefaultFlavorDebugJavaWithJavac'.
Build.grable
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
}
}
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
android {
compileSdkVersion 25
defaultConfig {
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
productFlavors {
defaultFlavor {
proguardFile 'proguard-rules.txt'
}
}
flavorDimensions "default"
}
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
dependencies {
implementation 'com.android.support:cardview-v7:25.2.0'
implementation 'com.android.support:recyclerview-v7:25.2.0'
implementation 'com.android.support:appcompat-v7:25.2.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.apis:google-api-services-youtube:v3-rev182-1.22.0'
implementation 'com.google.http-client:google-http-client-android:1.20.0'
implementation 'com.google.api-client:google-api-client-android:1.20.0'
implementation 'com.google.api-client:google-api-client-gson:1.20.0'
implementation 'com.github.PierfrancescoSoffritti:AndroidYouTubePlayer:7.0.0'
}
Try this code (app level grandle):
buildscript {
repositories {
maven { url "https://jitpack.io" }
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
allprojects {
repositories {
maven { url 'https://jitpack.io' }
jcenter()
google()
}
}
And project level grandle:
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 17
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
productFlavors {
defaultFlavor {
proguardFile 'proguard-rules.txt'
}
}
flavorDimensions "default"
}
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
dependencies {
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.apis:google-api-services-youtube:v3-rev182-1.22.0'
implementation 'com.google.http-client:google-http-client-android:1.20.0'
implementation 'com.google.api-client:google-api-client-android:1.20.0'
implementation 'com.google.api-client:google-api-client-gson:1.20.0'
implementation 'com.github.PierfrancescoSoffritti:AndroidYouTubePlayer:7.0.0'
}
Have you tried restarting android studio? or have you try cleaning / re-build the project? And pls also try to go to file -> invalidate caches / restart and then press that and press invalidate caches and restart.
I just found that there are bugs like this in Android Studio 3.1, pls try follow this link
Related
**Could not parse the android application modules gradle config firebase.
I don't know what to do,this is the first project.And I really can't solve it.
I've seen quite a lot of people getting this error, but it seems that they could solve it by upgrading their build tool version, or by updating google-services. I've done all that and haven't been able to make it work so far.
Here are my Gradle scripts:**
build.gradle(project)
buildscript {
ext.kotlin_version = '1.6.21'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20'
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
repositories {
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(module)
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.gms.google-services'
}
apply plugin: 'kotlin-android'
android {
compileSdk 32
defaultConfig {
applicationId "com.example.simplechatkotlin"
minSdk 21
targetSdk 32
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
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures{
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.6.0'
implementation platform('com.google.firebase:firebase-bom:30.0.0')
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.firebase:firebase-database:20.0.5'
implementation 'com.google.firebase:firebase-common-ktx:20.1.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation "androidx.core:core-ktx"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
repositories {
mavenCentral()
}
The Kotlin Gradle plugin version should match the Kotlin version you're using, so it should be 1.6.21. And the latest build tools version is 7.1.2.
buildscript {
ext.kotlin_version = '1.6.21'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21'
classpath 'com.google.gms:google-services:4.3.10'
}
}
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
AndroidManifest.xml Error: Package name
'android.support.graphics.drawable' used in:
com.android.support:animated-vector-drawable:28.0.0,
com.android.support:support-vector-drawable:28.0.0
https://imgur.com/6aFUN59
https://imgur.com/C1EmnJ3
An error happened after upgrade Android Studio 3.4
Already try change compileSdk to 27 / 27.1.1 but still same
and already try to disable "vector-drawable" lib but still same
.
.
.
.
.
.
.
.
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public'}
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.26.1'
classpath 'com.google.firebase:firebase-plugins:1.2.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'
android {
compileSdkVersion 28
defaultConfig {
applicationId "xxx.packacge.name"
minSdkVersion 21
targetSdkVersion 28
versionCode 4
versionName "Dev"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
applicationVariants.all { variant ->
//variant.getAssembleProvider()
variant.outputs.all {
outputFileName = "${variant.name}-${variant.versionName}.apk"
}
}
buildTypes {
release {
minifyEnabled false
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
buildToolsVersion = '28.0.3'
}
repositories {
mavenCentral()
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
configurations.all {
exclude group: 'com.android.support', module: 'support-v13'
}
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha5'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:support-fragment:28.0.0'
}
apply plugin: 'com.google.gms.google-services'
..
buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven {
url 'https://maven.fabric.io/public'
}
maven {
url 'https://maven.google.com/'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.firebase:firebase-plugins:1.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
mavenCentral()
maven {
url 'https://maven.google.com/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
..
You should try this way
implementation('com.android.support:support-vector-drawable:28.0.0') {
exclude group: 'android.support.graphics.drawable'
exclude module: 'support-vector-drawable'
}
implementation('com.android.support:support-vector-drawable:28.0.0') {
exclude group: 'android.support.graphics.drawable'
exclude module: 'support-vector-drawable'
}
try this one
Hello Fellows when i was trying to add the admob SDK i got this error :
Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: com.google.android.gms.security.ProviderInstaller
I've tried
Invalidating cache
cleaning and rebuilding
using ./gradlew build --stacktrace --info command
but without success.
This is what im getting every time :
Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: com.google.android.gms.security.ProviderInstaller
Here are my app build.grable :
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "ar.rulosoft.mimanganu"
versionCode 92
versionName "1.92"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
minSdkVersion 15
}
signingConfigs {
release {
storeFile file("../mimanganu.jks")
storePassword 'mimanganu'
keyAlias 'mimanganu'
keyPassword 'mimanganu'
}
debug {
storeFile file("../mimanganu.jks")
storePassword 'mimanganu'
keyAlias 'mimanganu'
keyPassword 'mimanganu'
}
}
buildTypes {
release {
lintOptions {
disable 'MissingTranslation'
disable 'NewApi' //Avoid problems in Android Studio 2.4 preview 6
}
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
debuggable true
signingConfig signingConfigs.debug
}
}
compileOptions.encoding = 'UTF-8'
flavorDimensions "builds"
productFlavors {
fdroid {
signingConfig signingConfigs.release
versionNameSuffix '-fdroid'
dimension "builds"
}
github {
signingConfig signingConfigs.release
//removed to maintain updates as now are
dimension "builds"
}
}
}
android.sourceSets {
test {
java.srcDirs += "$projectDir/src/testShare"
}
androidTest {
java.srcDirs += "$projectDir/src/testShare"
}
}
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:25.3.1'
}
dependencies {
final ANDROID_SUPPORT = '28.0.0'
implementation "com.android.support:support-v4:$ANDROID_SUPPORT"
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.android.support:design:$ANDROID_SUPPORT"
implementation "com.android.support:appcompat-v7:$ANDROID_SUPPORT"
implementation "com.android.support:recyclerview-v7:$ANDROID_SUPPORT"
implementation "com.android.support:preference-v7:$ANDROID_SUPPORT"
api project(':imageviewtouchlibrary')
implementation 'rapid.decoder:library:0.3.0'
implementation 'rapid.decoder:jpeg-decoder:0.3.0'
implementation 'rapid.decoder:png-decoder:0.3.0'
implementation 'com.squareup.okhttp3:okhttp:3.11.0' //on 3.10.0 are deprecated some ciphers
implementation 'com.squareup.okio:okio:1.15.0'
implementation 'com.squareup.duktape:duktape-android:1.3.0'/* v 1.2.0 need 4+mb extra*/
implementation 'com.github.franmontiel:PersistentCookieJar:v1.0.1'
implementation 'com.evernote:android-job:1.2.5'
githubImplementation 'com.google.android.gms:play-services-base:16.0.1'
// ADDED BY O D I N
implementation 'com.google.android.gms:play-services-ads:17.1.1'
// ADDED BY O D I N
implementation 'ch.acra:acra:4.9.2'
fdroidApi project(':fakegps')
// for device-based testing
androidTestImplementation "com.android.support:support-annotations:$ANDROID_SUPPORT"
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'junit:junit:4.12'
// for host-based testing
testImplementation 'junit:junit:4.12'
testImplementation 'org.robolectric:robolectric:4.0-beta-1'
android {
testOptions {
unitTests {
includeAndroidResources = true
}
}
}
}
Project's build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
// ADDED BY O D I N
maven {
url "https://maven.google.com"
}
// ADDED BY O D I N
maven {
url 'https://github.com/suckgamony/RapidDecoder/raw/master/repository'
}
google()
}
}
after so many attempt to add the SDK i still can't find any solution for this, Hope i find it here
Add maven { url 'https://maven.fabric.io/public' } to your Project build.gradle. Like below. This fixed it for me.
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.fabric.io/public' }
}
add
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 28
multiDexEnabled true
}
...
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
}
Multidex support prior to Android 5.0
dependencies {
def multidex_version = "2.0.1"
implementation 'androidx.multidex:multidex:$multidex_version'
}
https://developer.android.com/studio/build/multidex
I've met the same kind of error : com.android.tools.r8.utils.AbortException: Error: Program type already present: [com.some.lib].
After dumping all the dependencies in console (via ./gradlew dependencies > ./dept.txt), I found out a new added aar does contain the same dependent library as reported above, so just exclude that out. It's done.
implementation ('the-new-library') {
transitive = true
exclude group : 'duplicate-lib-pkg', module:"duplicate-lib-name"
}
I have a problem with Android Studio saying:
failed to resolve
com.google.code.ksoap2-android:ksoap2-android:3.6.1
Here is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.example.papiroomdemo.webservicetest"
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
repositories {
maven { url 'http://ksoap2-android.googlecode.com/svn/m2-repo' }
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.hannesdorfmann.smoothprogressbar:library:1.0.0'
compile 'com.github.castorflex.smoothprogressbar:library-circular:1.0.0'
}
Error:(30, 13) Failed to resolve:
com.google.code.ksoap2-android:ksoap2-android:3.6.1 Show in FileShow in Project Structure
dialog
I think your url in repositories section is invalid. You should add
https://oss.sonatype.org/content/repositories/ksoap2-android-releases/:
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
}
More info here: http://simpligility.github.io/ksoap2-android/getting-started
/// add these lines in module gradle
allprojects {
repositories {
google()
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/'
}
}
}