Despite Gradle is telling me build succesfull (and I can run the app), android studio cannot resolve "import android.support.v4" and for the support.v7 lib can only resolve appcompat... I tried the button "Use Sync project with gradle files", upgraded my build tools to the latest version but I still have this error.
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "me.myapp"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'org.jsoup:jsoup:1.8.2'
compile 'com.android.support:recyclerview-v7:22.1.1'
compile 'com.android.support:support-v4:22.1.1'
compile 'com.android.support:appcompat-v7:22.1.1'
}
Please help me fix this!
Follow the below steps.
Run all updates: Update android studio and SDK to the latest version.
go to File->invalidate caches/Restart.
Hope this fixes the problem.
Related
Full info of Errors:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
What went wrong:
Execution failed for task ':app:kaptGenerateStubsDebugKotlin'.
Error while evaluating property 'filteredArgumentsMap' of task ':app:kaptGenerateStubsDebugKotlin'
Could not resolve all files for configuration ':app:kapt'.
> Could not resolve com.github.bumptech.glide:glide:compiler.
Required by:
project :app
> No cached version of com.github.bumptech.glide:glide:compiler available for offline mode.
> No cached version of com.github.bumptech.glide:glide:compiler available for offline mode.
2: Task failed with an exception.
What went wrong:
Execution failed for task ':app:javaPreCompileDebug'.
Could not resolve all files for configuration ':app:_agp_internal_javaPreCompileDebug_kaptClasspath'.
Could not resolve com.github.bumptech.glide:glide:compiler.
Required by:
project :app
> No cached version of com.github.bumptech.glide:glide:compiler available for offline mode.
> No cached version of com.github.bumptech.glide:glide:compiler available for offline mode.
I updated all highlighted values in both Gradle files, but my project still don't start. I was creating this project follow this tutorial (https://www.youtube.com/watch?v=nKz_GyCvitw&list=PLaQox2QQZDpjCmqVPvJ5eDyN26UYEojAt&index=9).
I think it`s problem with Dagger&Hilt, because main errors by functions kapt in Gradle file.
I tried start project in toggle offline mode
My Gradle (Module) file
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'androidx.navigation.safeargs.kotlin'
id 'dagger.hilt.android.plugin'
id 'kotlin-kapt'
}
android {
namespace 'com.example.movieapp'
compileSdk 33
defaultConfig {
applicationId "com.example.movieapp"
minSdk 21
targetSdk 33
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 {
dataBinding = true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
implementation 'com.google.dagger:hilt-android:2.31.2-alpha'
kapt 'com.google.dagger:hilt-android-compiler:2.31.2-alpha'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'androidx.paging:paging-runtime-ktx:3.1.1'
implementation 'com.github.bumptech.glide:glide:4.13.0'
kapt 'com.github.bumptech.glide:glide:compiler:4.13.0'
}
My Gradle (Project) file
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
id 'androidx.navigation.safeargs' version '2.4.2' apply false
id 'com.google.dagger.hilt.android' version '2.41' apply false
}
After installing realm in react native and setting up all necessary things console give me this error after starting project (npm run android);
Execution failed for task ':realm:stripDebugDebugSymbols'. NDK at C:\Users\123\AppData\Local\Android\Sdk\ndk\21.4.7075529 did not have a source.properties file.
I check ndk in android studio (after opening project in it) in Android SDK --> SDK tools sections, the ndk already installed. I also change the ndk version (one by one) in android/build.gradle according to some other stackoverflow solutions but didn't work. Below is android/build.gradle code;
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "21.4.7075529"//"25.1.8937393"//"21.1.6528147"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
This is a android studio screen shot of sdk tools SDK tools
I checked all solutions and I got the answer that I need to update the Android -Studio version.
Android Studio: 3.2
Gradle Version: 5.1.1
Android Plugin Version: 3.4.2
This problem raised when I was trying to integrate Youtube API.
Gradle (project):
classpath 'com.android.tools.build:gradle:3.4.2'
Tried to update AS version, but still, it is showing AS 3.2
android {
compileSdkVersion 28
defaultConfig {
applicationId "mateiladesign.practice.com.materialdesign"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0 alpha-03' //2.2.0-alpha03 2.0.0-alpha01
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.3.0-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha02'
//AndroidX
implementation 'com.google.android.material:material:1.1.0 alpha09' //1.0.0-alpha03
//Recycler
implementation 'com.android.support:recyclerview-v7:28.0.0'
//Hodenhof Circle ImageView
implementation 'de.hdodenhof:circleimageview:3.0.0'
//Glide
implementation 'com.github.bumptech.glide:glide:4.9.0'
//YTAPI
implementation files('libs/YouTubeAndroidPlayerApi.jar')
}
What do I do to resolve this issue?
Cause: org.jetbrains.plugins.gradle.tooling.util.ModuleComponentIdentifierImpl.getModuleIdentifier()Lorg/gradle/api/artifacts/ModuleIdentifier;
D:\projects\fortuna\node_modules\react-native-admob\android\src\main\java\com\sbugert\rnadmob\RNAdMobRewardedVideoAdModule.java:89: error: method does not override or implement a method from a supertype
#Override
^
1 error
:react-native-admob:compileReleaseJavaWithJavac FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':react-native-admob:compileReleaseJavaWithJavac'.
How can i fix this?
This answer is correct with old react versions. With latest version you should put this code in admob android build.gradle file: \node_modules\react-native-admob\android\build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 26
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.facebook.react:react-native:+'
implementation 'com.google.android.gms:play-services-ads:16.0.0'
}
There should be a
#Override
in line 89 of
RNAdMobRewardedVideoAdModule.java file.
Delete it and you should be good to go.
As the title indicates I cannot run an Android Project made on Android Studio 0.8 with Gradle 0.12.2 on my Android Studio 1.1.
-I have changed the classpath to:
classpath 'com.android.tools.build:gradle:1.0.+' in the build.gradle file of THE PROJECT.
-I have replaced the runProGuard() with minifyEnabled true in the same file
-I replaced the previous distributionUrl
with this: distributionUrl=https://services.gradle.org/distributions/gradle-2.2.1-all.zip in the gradle-wrapper.properties file
Here is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.0.2"
defaultConfig {
applicationId "tuwien.server_app"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.+'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/sshj-0.8.1.jar')
compile files('bcpkix-jdk15on-151.jar')
compile files('bcprov-jdk15on-151.jar')
compile files('slf4j-api-1.7.7.jar')
compile files('slf4j-simple-1.7.7.jar')
compile 'com.jcraft:jzlib:1.1.1'
compile files ('gson-1.7.1.jar')
compile "com.android.support:support-v4:21.0.0"
}
What do I miss?? Any suggestions??