Android Studio BumbleBee, Maven() - android-studio

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" }

Related

Android studio can't publish a library on mavenLocal with maven-publish plugin

I searched a lot on the web, but couldn't find a solution. I have a a project named VolleyLib with a library module named volleylib. I'm trying to publish the library on mavenLocal repo, but when build the project no publishing task is executed (only prepareLintJarForPublish). And of course nothing goes into .m2 folder (which I created myself after installed maven...). I can't really get why and what is wrong. Probably something's missing...
Here's my build.gradle for volleylib module:
plugins {
id 'com.android.library'
id 'maven-publish'
}
android {
compileSdk 31
defaultConfig {
minSdk 22
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.4.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.android.volley:volley:1.2.1'
implementation 'com.fasterxml.jackson.jr:jackson-jr-annotation-support:2.13.1'
implementation 'androidx.room:room-common:2.4.1'
annotationProcessor 'androidx.room:room-compiler:2.4.1'
implementation 'androidx.room:room-coroutines:2.1.0-alpha04'
implementation 'androidx.room:room-runtime:2.4.1'
implementation 'androidx.room:room-migration:2.4.1'
implementation 'androidx.room:room-rxjava2:2.4.1'
}
afterEvaluate {
publishing {
publications {
// Creates a Maven publication called "release".
release(MavenPublication) {
// Applies the component for the release build variant.
from components.release
// You can then customize attributes of the publication as shown below.
groupId = 'com.example.VolleyLib'
artifactId = 'final'
version = '1.0'
}
// Creates a Maven publication called “debug”.
debug(MavenPublication) {
// Applies the component for the debug build variant.
from components.debug
groupId = 'com.example.VolleyLib'
artifactId = 'final-debug'
version = '1.0'
}
}
repositories {
mavenLocal()
}
}
}
Any help would be greatly appreciated.
It's the first time I try this, so apologize if it's a trivial question...
Thank you all in advance.
My working library build.gradle is almost like yours. Except, it doesn't use the following:
plugins {
id 'com.android.library'
id 'maven-publish'
}
but the following:
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
And I'm using Java 8 for compileOptions block:
android {
...
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
And, lastly, without repositories in afterEvaluate:
afterEvaluate {
publishing {
...
// Remove the following commented line:
// repositories {
// mavenLocal()
// }
}
}
Then, to build and install the library to maven local, click gradle icon on the left menu of Android Studio. Then select projectName -> libraryName -> Run Configuration -> publishToMavenLocal.
UPDATE:
Here the complete build.gradle.
root build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.1'
}
}
repositories {
mavenCentral()
}
allprojects {
repositories {
jcenter()
mavenLocal()
mavenCentral()
maven { url "https://jitpack.io" }
google()
}
}
ext {
compileSdkVersion = 31
buildToolsVersion = '30.0.2'
minSdkVersion = 16
targetSdkVersion = 31
junitVersion = '4.13.2'
androidxAppcompatVersion = '1.4.1'
androidApplicationId = 'com.project.sample'
androidVersionCode = 1000
androidVersionName = "1.0.0"
androidAppName = 'Sample'
}
my library build.gradle (jcplayer library in root/jcplayer directory):
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation "androidx.appcompat:appcompat:$androidxAppcompatVersion"
}
// Because the components are created only during the afterEvaluate phase, you must
// configure your publications using the afterEvaluate() lifecycle method.
afterEvaluate {
publishing {
publications {
// Creates a Maven publication called "release".
jcplayer(MavenPublication) {
// Applies the component for the release build variant.
from components.release
// You can then customize attributes of the publication as shown below.
groupId = rootProject.ext.androidApplicationId
artifactId = 'jcplayer'
version = rootProject.ext.androidVersionName
}
}
}
}

Could not find :ARPresto:. Required by: project :unityLibrary Search in build.gradle files

I am currently integrating a Unity AR project as a library in a native Android Studio project. It is all fine with the exception that when I try to build/run the project in Android Studio I get the exception from the title:
Could not find :ARPresto:.
Required by:
project :unityLibrary
Search in build.gradle files
I have no idea why this happens since the unity project seems to be successfully integrated as a library and I can open in the in Android Studio project menu.
This is the build.gradle file of the Unity Library:
allprojects {
buildscript {
repositories {
google()
flatDir {
dirs "${project(':unityLibrary').projectDir}/libs"
}
}
}
}
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
apply plugin: 'com.android.library'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation(name: 'ARPresto', ext:'aar')
implementation(name: 'unityandroidpermissions', ext:'aar')
implementation(name: 'VuforiaEngine', ext:'aar')
}
android {
compileSdkVersion 31
buildToolsVersion '30.0.3'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion 26
targetSdkVersion 31
ndk { abiFilters 'armeabi-v7a' }
ndk {
// Default ABI list for this app, can be over-ridden by providing an abiList property
// e.g. gradle -PabiList=x86 clean assembleDebug
abiFilters ((project.findProperty('abiList') ?: 'armeabi-v7a, arm64-v8a').split(/,\s*/))
}
versionCode 1
versionName '0.1'
consumerProguardFiles 'proguard-unity.txt'
}
lintOptions {
abortOnError false
}
aaptOptions {
noCompress = ['.ress', '.resource', '.obb'] + unityStreamingAssets.tokenize(', ')
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
}
packagingOptions {
doNotStrip '*/armeabi-v7a/*.so'
}
}
This is the module and project gradle files of the parent android app:
Project
ext {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
// flatDir {
// dirs "${project(':unityLibrary').projectDir}/libs"
// }
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Module
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.project.chemistryar"
minSdk 26
targetSdk 31
versionCode 1
versionName "1.0"
ndk{
abiFilters 'armeabi-v7a','x86'
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
kotlinOptions {
jvmTarget = '1.8'
}
compileSdkVersion 31
buildToolsVersion '30.0.3'
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation project(path: ':unityLibrary')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.google.android.material:material:1.4.0'
// unity
//implementation project(':unityLibrary')
//implementation fileTree(dir: project(':unityLibrary').getProjectDir().toString() + ('\\libs'), include: ['*.jar'])
//bottom navigation bar
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
}

Android studio : Could not find package from gitlab

I'm trying to start sample_client application of owncloud android library.
You can find the library here :
https://github.com/owncloud/android-library#:~:text=%20ownCloud%20Android%20Library%20%201%20Introduction.%20Using,code%20of%20HEAD...%204%20Compatibility.%20%20More
I changed gradle files to get packages. My problem is as follows:
Execution failed for task ':owncloudComLibrary:generateDebugRFile'.
Could not resolve all files for configuration ':owncloudComLibrary:debugCompileClasspath'.
Could not find com.gitlab.ownclouders:dav4android:oc_support_2.1.5.
Required by:
project :owncloudComLibrary
Could not find com.github.AppDevNext.Logcat:LogcatCore:2.2.2.
Required by:
project :owncloudComLibrary
Simple_client app build.gradle :
apply plugin: 'com.android.application'
buildscript{
repositories{
jcenter()
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies{
classpath 'com.android.tools.build:gradle:4.1.2'
}
}
repositories{
jcenter()
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
implementation project(':owncloudComLibrary')
}
android {
compileSdkVersion 30
defaultConfig {
minSdkVersion 21
targetSdkVersion 30
// This is pretty ugly but manifest placeholders don't seem to work very well when using different modules
// See https://github.com/openid/AppAuth-Android/issues/325
manifestPlaceholders = [appAuthRedirectScheme: '']
}
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
Library build.gradle :
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
buildscript {
ext {
kotlinVersion = "1.3.31"
}
repositories{
jcenter()
google()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
repositories {
mavenCentral()
google()
jcenter()
}
dependencies {
api 'com.squareup.okhttp3:okhttp:4.6.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31"
api 'com.gitlab.ownclouders:dav4android:oc_support_2.1.5'
api 'com.github.AppDevNext.Logcat:LogcatCore:2.2.2'
// Moshi
implementation ("com.squareup.moshi:moshi-kotlin:1.11.0") {
exclude module: "kotlin-reflect"
}
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.11.0"
testImplementation 'junit:junit:4.13.1'
}
android {
compileSdkVersion 29
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
versionCode = 10000900
versionName = "1.0.9"
}
lintOptions {
abortOnError false
ignoreWarnings true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
Thank you for your help

Failed to resolve: com.google.android.gms:play-services:15.0.1

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()
}}

Issue with running a gradle project on android

I am trying to run a project that I found on github, This is the link to the project. I tried to put it in android studio, Unfortunately I cant create a configuration to run for that project. Its a library project. How can I install it. There is no modules appearing for this project. This is the gradle file
buildscript {
repositories {
jcenter()
mavenLocal()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
classpath "gradle.plugin.nl.javadude.gradle.plugins:license-gradle-plugin:0.12.1"
}
}
allprojects {
repositories {
jcenter()
mavenLocal()
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
}
apply plugin: 'com.android.library'
apply plugin: "com.github.hierynomus.license"
license {
license {
header = file('HEADER.txt')
skipExistingHeaders = true
ignoreFailures = false
}
}
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 15
versionCode Integer.parseInt(project.VERSION_CODE)
versionName project.VERSION_NAME
}
buildTypes {
release {
minifyEnabled false
}
}
lintOptions {
disable 'InvalidPackage'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.fasterxml.jackson.core:jackson-databind:2.7.1-1'
}
def isReleaseBuild() {
return project.VERSION_NAME.contains("SNAPSHOT") == false
}
apply from: './maven_push.gradle'
Since it is a library you can only run with a app that you are developing and not run it as stand alone.

Resources