Android Studio: Error "Failed to resolve: design"? - android-studio

Hi I receive this error message on gradle project sync.
"Failed to resolve: design"
I can't find what's this.
Is there any friend that can help me with this? Or do you have another icon pack Android Studio project?
It's from CandyBar-Sample-Master android icon pack project.
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.ext.CompileSdk
android.applicationVariants.all { variant ->
variant.outputs.all { output ->
def appName = parent.name
def fileName = appName.replace(" ", "_")
outputFileName = "$fileName-v${variant.versionName}.apk"
}
}
defaultConfig {
applicationId "com.grafiman.icons.selero"
minSdkVersion rootProject.ext.MinSdk
targetSdkVersion rootProject.ext.TargetSdk
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '27.0.3'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.github.danimahardhika.candybar-library:core:3.5.0-b4'
}

// 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.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
google()
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com' }
}
//NOTE: This is important
rootProject.ext {
BuildTools = "27.0.3"
MinSdk = 15
TargetSdk = 26
CompileSdk = 26
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Related

No signature of method: org.gradle.api.tasks.bundling.Jar.destinationDir()

I'm getting this error
What went wrong:
A problem occurred evaluating root project 'android'.
A problem occurred configuring project ':app'.
Could not create task ':app:packLibsflutterBuildDebug'.
> No signature of method: org.gradle.api.tasks.bundling.Jar.destinationDir() is applicable for argument types: (File) values: [/Users/amjadkhoulani/Downloads/food_app12amjad/build/app/intermediates/flutter/debug]
build.gradle
buildscript {
ext {
kotlin_version = '1.5.0'
}
repositories {
google()
jcenter()
gradlePluginPortal()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.10, 0.99.99]'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
defaultConfig {
// Required by the Flutter WebView plugin.
minSdkVersion 21
}
compileSdkVersion rootProject.ext.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.food_app"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 20
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
manifestPlaceholders = [applicationName: "android.app.Application"]
}
debug {
manifestPlaceholders = [applicationName: "android.app.Application"]
}
build{
manifestPlaceholders = [applicationName: "android.app.Application"]
}
}
}
app/build.gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
android {
compileSdk 33
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.example.abc.test"
minSdkVersion 21
targetSdkVersion 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
apply plugin: 'kotlin-android'
apply plugin: "kotlin-android-extensions"
androidExtensions {
experimental = true
}
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
flutter {
source '../..'
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:26.3.0')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.onesignal:OneSignal:[4.0.0, 4.99.99]'
implementation 'com.google.android.material:material:33'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
......................
This can happen if your gradle dependencies are out of date or out of sync.
android/build.gradle
Find the most recent, stable version of com.android.tools.build from here and update your dependencies:
dependencies {
...
classpath 'com.android.tools.build:gradle:7.4.1'
}
android/gradle/wrapper/gradle-wrapper.properties
Find the most recent stable version of Gradle from here and update the distribution URL.
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip

Flutter build error : Could not resolve all artifacts for configuration ':app:debugRuntimeClasspath'

I try to build apk in my flutter application. I am got one warning and one error. Warning message : Your Flutter application is created using an older version of the Android embedding. It's being deprecated in favor of Android embedding v2.
Error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugRuntimeClasspath'.
> Failed to transform libs.jar to match attributes {artifactType=processed-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: C:\Users\Abdulkadhar\Documents\Android\AppDevelopment\Production\simply2be_production\build\app\intermediates\flutter\debug\libs.jar.
> Transform's input file does not exist: C:\Users\Abdulkadhar\Documents\Android\AppDevelopment\Production\simply2be_production\build\app\intermediates\flutter\debug\libs.jar. (See https://issuetracker.google.com/issues/158753935)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 4m 1s
Running Gradle task 'assembleRelease'... 243.1s (!)
Gradle task assembleRelease failed with exit code 1
Process finished with exit code 1
My app gradle
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '2'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 29
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "app.projects.xxx.xxxx"
minSdkVersion 19
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.release
minifyEnabled true
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
flutter {
source '../..'
}
//apply plugin: 'com.android.application'
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
//implementation 'com.google.firebase:firebase-analytics:17.2.1'
implementation 'com.google.firebase:firebase-messaging:20.0.1'
implementation 'com.google.firebase:firebase-core'
}
apply plugin: 'com.google.gms.google-services'
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}}
My build gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'//4.0.0'//3.3.2 //3.5.3 //3.4.2
classpath 'com.google.gms:google-services:4.3.2'
}
}
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
}
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
}
}
}
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}}
Here are my Gradle wrapper properties in case they are also important.
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
My gradle.properties
org.gradle.jvmargs=-Xmx1536m -Duser.country=US -Duser.language=en
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true

Android Studio Wikitude Native SDK Issue

So im trying to first build a basic app using android studio and Wikitudes Native SDK to make an AR app. After following the setup instructions ive ran into an error I cant seem to solve but have an idea of why/where its happening. Does anyone know what could be causing these errors?
This image here shows the errors I am getting and what looks to be an issue with a few of the imports
Here is also a copy of my build.gradle file (Module: app), and my build.gradle file (Module: NativeSDKExamples), respectively:
apply plugin: 'com.android.application'
android {
compileSdkVersion commonCompileSdkVersion
buildToolsVersion commonBuildToolsVersion
defaultConfig {
applicationId "com.uhg.ent.mobile.lifesciences.amplify"
minSdkVersion commonMinSdkVersion
targetSdkVersion commonTargetSdkVersion
versionCode 1
versionName "7.2.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable true
}
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def fileName = "app-" + variant.buildType.name + ".apk"
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
flavorDimensions "arch"
productFlavors {
arm7 {
dimension "arch"
}
arm8 {
dimension "arch"
}
x86 {
dimension "arch"
}
allarchs {
dimension "arch"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile (name: 'wikitude-native-sdk', ext:'aar')
arm7Compile project(path: ':plugins', configuration: 'arm7Release')
arm8Compile project(path: ':plugins', configuration: 'arm8Release')
x86Compile project(path: ':plugins', configuration: 'x86Release')
allarchsCompile project(path: ':plugins', configuration: 'allarchsRelease')
compile "com.android.support:appcompat-v7:$commonSupportLibVersion"
compile "com.android.support:design:$commonSupportLibVersion"
compile "com.android.support:support-v4:$commonSupportLibVersion"
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android:flexbox:0.2.5'
}
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
AND
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
subprojects {
ext.commonCompileSdkVersion = 26
ext.commonBuildToolsVersion = "26.0.0"
ext.commonMinSdkVersion = 19
ext.commonTargetSdkVersion = 26
ext.commonSupportLibVersion = "26.0.0"
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}

Android studio not publishing artifact to Artifactory

I'm facing an odd problem with Android Studio and Artifactory. I want to publish a module from Android Studio. The problem being, the build info is published just fine but the artifacts are not published.
build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.5.4"
}
}
allprojects {
apply plugin: "com.jfrog.artifactory"
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
artifactory {
contextUrl = "${artifactory_contextUrl}"
publish {
repository {
repoKey = 'libs-release-local'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
resolve {
repository {
repoKey = 'libs-release'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
}
module/build.gradle
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
def packageName = 'x.x'
def libraryVersion = 'v1.0.0'
android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 21
targetSdkVersion 26
versionCode 10000
versionName libraryVersion
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
publishing {
publications {
aar(MavenPublication) {
groupId packageName
version = libraryVersion
artifactId "y"
artifact("$buildDir/outputs/aar/$archivesBaseName-release.aar")
}
}
}
artifactory {
publish {
defaults {
publications('aar')
publishArtifacts = true
publishBuildInfo = false
publishPom = true
publishIvy = false
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.squareup.okhttp3:okhttp:3.8.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.1'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
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'
}
When I run ./gradlew assembleRelease artifactoryPublish from the terminal, I always get the following output:
> Task :minecommon:artifactoryPublish
Deploying build descriptor to: https://artifactory-domain/artifactory/api/build
Build successfully deployed. Browse it in Artifactory under https://artifactory-domain/artifactory/webapp/builds/project-name/1509633107114
BUILD SUCCESSFUL in 2s
26 actionable tasks: 1 executed, 25 up-to-date
I can find the build in the "Build Browser" of my Artifactory.
Is there something wrong with my configuration? How can I make gradle publish my artifacts?
I've tries every article I could find on this issue to no resolve.

How to use new gradle experimental in Android Studio

I made a very hello world with Android Studio NDK. As instructed from http://tools.android.com/tech-docs/new-build-system/gradle-experimental, I copied exactly the same (left only some newer build tool version), but the error always appears:
Error:(49, 1) A problem occurred evaluating project ':app'.
Could not find method testCompile() for arguments [junit:junit:4.12] on project ':app'.
Could you tell me what's problem with my HelloWorld?
Here's my app build.gradle
apply plugin: "com.android.model.application"
model {
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig.with {
applicationId = "com.android.services.testjni"
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 23
versionCode = 1
versionName = "1.0"
buildConfigFields.with {
create() {
type = "int"
name = "VALUE"
value = "1"
}
}
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles.add(file("proguard-rules.pro"))
}
}
android.productFlavors {
create("flavor1") {
applicationId = "com.app"
}
}
// Configures source set directory.
android.sources {
main {
java {
source {
srcDir "src"
}
}
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}
and build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle-experimental:0.2.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and gradle-wrapper.properties
#Fri Nov 27 17:00:16 ICT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip
AFAIK, android plugin doesn't have a testCompile configuration, which is one from gradle's java plugin, but has an androidTestCompile. So, you have to rename it in your dependencies, as:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}

Resources