how to use org.mockito.ArgumentMatchers.startsWith with Android Studio Chipmunk 2021.2.1 Patch 1 - android-studio

It pushes to upgrade Gradle plugin, but once I did it, the whole bunch of errors pop up.
It looks like my project build.gradle:
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
}
module build.gradle:
dependencies {
...
testImplementation 'junit:junit:4.+'
testImplementation 'org.mockito:mockito-core:2.4.0'
testImplementation 'org.powermock:powermock-core:1.7.0RC2'
testImplementation 'org.powermock:powermock-module-junit4:1.7.0RC2'
testImplementation 'org.powermock:powermock-api-mockito2:1.7.0RC2'
}
and gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
do not work anymore.
I tried to change them, but could not bring my powermock back.
What is the right combination of versions?

Related

Android Studio Arctic fox test run shows "nothing here"

I've tried so many things from invalidate cache/restart to clean re installing android studio multiple times now. nothing seems to work.
in my build.gradle (project level)
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
...
build.gradle (app level)
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.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"
}
I've enabled corretto-1.8 version of the gradle jdk in settings and the plugins for JUint is enabled.
I cannot seems to find any solution to this issue.
P.S. I have update the windows to windows 11 recently. The above issue was persisting before that.

Version 28 is the latest version of the legacy support

Hello iam trying to add this library :compile 'com.android.support:cardview-v7:28.0.0\n'
but getting error: Version 28 (intended for Android Pie and below) is the last version of the legacy support library, so we recommend that you migrate to AndroidX libraries when using Android Q and moving forward. The IDE can help with this: Refactor > Migrate to AndroidX...
any fix?
Bro its very simple just change
com.android.support:cardview-v7:(your targetsdkversion digits).0.0
instead of com.android.support:cardview-v7:28.0.0...it will work
Use the following dependencies instead of old ones in gradle scripts on Module level
dependencies {
implementation 'androidx.preference:preference:1.2.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

Version Conflict either updating the version of the google-services plugin

So I tried to connect my firebase database to my android studio application.I get this error:
Please fix the version conflict either by updating the version of the
google-services plugin (information about the latest version is
available at
https://bintray.com/android/android-tools/com.google.gms.google-services/)
or updating the version of com.google.android.gms to 9.0.0.
I changed the version but it still does not work. As you can see I changed the version 16.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.firebase:firebase-database:16.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
I don't see the problem. I am stuck on this for hours.
Make sure You have gms classpath provided in your Project build.gradle, like this:
dependencies {
...
classpath 'com.google.gms:google-services:4.3.2'
}

Gradle sync issue in Android Studio 3.2.1

I have updated my Android studio to 3.2.1 since then am getting error as below
Unable to resolve dependency for ':app#debug/compileClasspath': Could
not resolve com.android.support:appcompat-v7:28.0.0.
hence unable to build my application
I have unchecked offline too
my dependencies in gradle file
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
kindly suggest a solution for this
Regards.
Nagendra
I think you are using old version of build tool in project level build.gradle.
Try
classpath 'com.android.tools.build:gradle:3.2.1'
Update your Android Gradle plugin
1- Upade the classpath in top-level build.gradle to:
buildscript {
....
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
2- Update the Gradle version to 4.6 in the gradle-wrapper.properties file by changing the distributionUrl to:
...
distributionUrl = https\://services.gradle.org/distributions/gradle-4.6-all.zip
...
3- Go to ReBuild Project
classpath 'com.android.tools.build:gradle:3.2.1'
add this to the dependencies of buildscript. then Sync the project.
Thanks for the response,
Isuue was with proxy blocking the downloads,i have commented the proxy in gradle.properties then its started working, i was trying in the office network.
Regards.
Nagendra

Android Studio can not resolve AutoValue class

I started to use AutoValue today in one of my projects and what bothers me is that Android Studio can not resolve the generated class name (AutoValue_DrawableContent) and marks it with the red color:
How I can suppress this warning?
Add the "idea" plugin to your build.gradle, for example:
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'net.ltgt.apt'
With this plugin, Android Studio can find the generated source files.
you can just comment out each dependencies and sync one by one... it might get things fixed...
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
Now that you have annotated your class, you need to build your project. This will generate the missing class, and Android Studio will be able to find it afterwards.
The build will not fail even though the editor is currently not recognizing the class name, because code generation will happen before the class is compiled.
Generate implementation class(es). AutoValue lib will do that.
Add these dynamically class(es) directory into source path. android-apt plugin will do this. After doing this, ide will know AutoValue_* and not to show errors.

Resources