I want to install Picasso Library in Android Studio:
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
***implementation 'com.squareup.picasso:picasso:2.71828'***
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
after sync gradle , it gave this warning :
Failed to resolve: androidx.exifinterface:exifinterface:1.0.0
Show in Project Structure dialog
Affected Modules: app
set this code in build.gradle
buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.google.com' }
flatDir {
dirs 'libs'
}
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.google.com' }
flatDir {
dirs 'libs'
}
}
}
I think you are in a boycott country and you can not use this product You must use a strong filter breaker to be able to install the package properly
Related
I updated the Android Studio and Created a new project.
I'm using some dependencies from GitHub, but after sync now, I'm getting this warning. If I ignore it, the application won't get installed.
Project Level build.gradle
buildscript {
ext {
compose_version = '1.6.10'
}
dependencies {
classpath 'com.google.gms:google-services:4.3.10'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10'
}
}
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
id 'org.jetbrains.kotlin.android' version '1.5.31' apply false
}
allprojects {
repositories {
google()
maven { url 'https://jitpack.io' }
maven {
url "https://maven.google.com"
}
// mavenCentral()
maven { url 'https://github.com/leonardocardoso/mvn-repo/raw/master/maven-deploy' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App Level build.gradle
plugins {
id 'com.android.application'
}
android {
compileSdk 31
buildFeatures {
dataBinding true
}
defaultConfig {
applicationId "com.eg.eg"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = 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 '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'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$compose_version"
implementation 'com.github.scottyab:showhidepasswordedittext:0.8'
}
settings.gradle
import org.gradle.api.initialization.resolve.RepositoriesMode
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "MyPro_v02"
include ':app'
How To Resolve this issue in Android Studio latest version BumbleBee?
For newer Android Studio projects created in Android Studio Bumblebee | 2021.1.1 or newer, the JitPack repository needs to be added into the root level file settings.gradle instead of build.gradle:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
// ...
maven { url 'https://jitpack.io' }
}
}
Add this line in your settings.gradle (bumblebee version)
after add this line Rebuild Project:-
jcenter()
maven { url "https://jitpack.io" }
I`m using Android Studio for Developing Flutter Application. After I install the Kotlin plugin in Android Studion, Application is not working. Then I remove that plugin but it's not working
build.gradle file
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
dependencies {
implementation 'com.android.support:support-annotations:28.0.0'
}
Terminal
Error Message in Terminal
Getting the following error while sync gradle, I checked other answers related to similar questions and followed their answers but still getting the same error
Failed to resolve: com.google.android.gms:play-services:15.0.1
Install Repository and sync project Show in File Show in Project
Structure dialog
When I click "Install Repository and sync project" then I get following error
Could not find dependency "com.google.android.gms:play-services:15.0.1"
following is app level gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "mpathak.drivetestapp"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
java.srcDirs = ['src/main/java', 'src/main/java/Entities', 'src/main/java/mpathak.drivetestapp', 'src/main/java/mpathak.drivetestapp/interfaces', 'src/main/java/interfaces']
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
implementation 'com.google.dagger:dagger:2.6'
annotationProcessor 'com.google.dagger:dagger-compiler:2.6'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.google.android.gms:play-services-drive:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services:15.0.1'
implementation 'com.google.android.gms:play-services-identity:15.0.1'
}
and my module gradle (top-level) is as follows
buildscript {
repositories {
jcenter()
maven {url "https://maven.google.com"}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {url "https://maven.google.com"}
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I am following the conventions, repo as stated in
https://developers.google.com/android/guides/setup
Try without this implementation "com.google.android.gms:play-services:15.0.1"
but concrete libraries like
implementation "com.google.android.gms:play-services-gcm:15.0.1"
I just found the issue it was due to the sequence of jcenter() library project build.gradle
Issue because of this sequence
allprojects {
repositories {
jcenter()
google()
maven {
url "https://maven.google.com"
}
maven {
url "https://jitpack.io"
}
}}
Solution sequence below
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
maven {
url "https://jitpack.io"
}
jcenter()
google()
}}
When I run the Android App in Android Studio, I get the following error:
Error:Build Config field cannot have a null parameter
Consult IDE log for more details (Help | Show Log)
'build.gradle' file code:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.1'
}
}
allprojects {
repositories {
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
'gradle-wrapper.properties' file code:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
Here is the below 'build.gradle' code inside the app subfolder. It has something called 'google_nearby_api_key'. Not sure if that's causing the issue:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.25.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
jcenter()
google()
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://jitpack.io' }
}
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.sg.blahblah"
minSdkVersion 21
targetSdkVersion 27
versionCode 24
versionName "1.0.4"
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
def filesAuthorityValue = applicationId + ".files"
manifestPlaceholders = [filesAuthority: filesAuthorityValue]
buildConfigField "String", "FILES_AUTORITY", "\"${filesAuthorityValue}\""
resValue "string", "google_nearby_api_key",
getLocalProperties().getProperty("google_nearby_api_key")
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'LICENSE'
exclude 'LICENSE.txt'
exclude 'NOTICE'
exclude 'asm-license.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:cardview-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.google.android.gms:play-services-nearby:11.8.0'
implementation 'com.google.android.gms:play-services-appinvite:11.8.0'
implementation 'com.google.android.gms:play-services-analytics:11.8.0'
// Dagger
implementation 'com.google.dagger:dagger:2.14'
annotationProcessor 'com.google.dagger:dagger-compiler:2.14'
// Logging
implementation 'com.jakewharton.timber:timber:4.5.1'
// View injection
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
// Database
implementation 'com.j256.ormlite:ormlite-android:4.48'
// Fonts
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
// Image loading
implementation 'com.squareup.picasso:picasso:2.5.2'
// Crop avatar
implementation 'com.lyft:scissors:1.0.1'
// JSON serialization
implementation 'com.google.code.gson:gson:2.8.2'
// Crash & usage monitoring
implementation('com.crashlytics.sdk.android:crashlytics:2.8.0#aar') {
transitive = true;
}
// Generate fake data
implementation 'com.github.blocoio:faker:1.2.5'
// Testing
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.10.0'
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support:support-annotations:27.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test:rules:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
androidTestImplementation('com.android.support.test.espresso:espresso-contrib:3.0.1') {
exclude module: 'recyclerview-v7'
exclude module: 'support-v4'
}
}
apply plugin: 'com.google.gms.google-services'
def getLocalProperties() {
Properties properties = new Properties()
properties.load(new File(rootDir.absolutePath + "/local.properties").newDataInputStream())
return properties
}
Can you please help?
Thanks in advance
This seems to come from here:
resValue "string", "google_nearby_api_key",
getLocalProperties().getProperty("google_nearby_api_key")
I guess the property google_nearby_api_key is not defined.
I have developed an app on eclipse and I lately started working with android studio, when I first moved the app all the dependencies were moved smoothly without any problem,
now I am trying to add the feature to share through Facebook and twitter, but for twitter whenever I try to use any plugin in the build.gradle the manifest disappears. As shown in the code below:
build.gradle (Project: project name)
The problem is in this file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: com.android.application
buildscript {
repositories {
jcenter()
//maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
//classpath 'io.fabric.tools:gradle:1.+'
}
}
//apply plugin: 'io.fabric'
allprojects {
repositories {
jcenter()
// maven { url 'https://maven.fabric.io/public' }
}
}
/*dependencies {
compile('com.twitter.sdk.android:twitter:1.14.1#aar') {
transitive = true;
}
}
android {
sourceSets {
main {
manifest.srcFile 'app/src/main/AndroidManifest.xml'
}
}
}*/
build.gradle (Module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '24.0.0 rc4'
defaultConfig {
applicationId "com.nwf.ICDLeKitab"
minSdkVersion 14
targetSdkVersion 14
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}
dependencies {
compile files('libs/icu4j-4_4_2_2.jar')
compile files('libs/jsoup-1.6.3.jar')
compile files('libs/ksoap2-android-assembly-2.6.0-jar-with-dependencies.jar')
compile files('libs/zip4j_1.2.6.jar')
//compile project('com.facebook:facebook-android-sdk-4.0.1')
}
Can someone explain for me what is it happening? and how should I work with Libraries and dependencies in android studio.
Thank you
You are doing it wrong. Inside buildscript, there should be only a single import. Like so:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
// do not add any more things here!
}
dependencies {
classpath 'io.fabric.tools:gradle:1.21.5'
// do not add any more things here, either!
}
}
If you want to import more libraries, add them inside your dependencies block.
So your updated build.gradle will look like:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: com.android.application
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'io.fabric'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
allprojects {
repositories {
jcenter()
// maven { url 'https://maven.fabric.io/public' }
}
}
dependencies {
compile('com.twitter.sdk.android:twitter:1.14.1#aar') {
transitive = true;
}
// replace following with your imports
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
}
android {
sourceSets {
main {
manifest.srcFile 'app/src/main/AndroidManifest.xml'
}
}
}