I have 'inherited' a source code that I should maintain. It contains import statements about fizzbuzz and dagger that fail. I never used those and am stuck now.
Here the dependencies in build.gradle:
Related
In my gradle.properties I have this:
android.useAndroidX=true
When I Make Project, I get BUILD SUCCESSFUL. From Android Studio, I go to Refactor > Migrate to AndroidX... I am getting 15 references in 9 files to be changed:
Reading https://medium.com/androiddevelopers/migrating-to-androidx-tip-tricks-and-guidance-88d5de238876, I see that the step 1 of the recommended approach to migrate is to Update to Support Library version 28. In order to do that, I want to know what Support Library version the code of my app is at. Where can I see that? In some of my .java files I have found the following:
import android.support.annotation.NonNull;
import android.support.v4.app.NotificationCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v4.content.ContextCompat;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentActivity;
import android.support.multidex.MultiDex;
In my app\build.gradle I have this: implementation 'com.android.support:multidex:1.0.3'.
Do any of the lines above reveals or helps to reveal the Support Library version that the code of my app is at? Thank you.
What it means is that they suggest upgrading all of the possible support libraries to 28.0.
Those are basically anything that starts with com.android.support:
e.g.:
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:gridlayout-v7:28.0.0'
The recommendation there is so the migration in the AS will have to do minimal guessing on how to migrate it.
So to stricly answer your question, the version you use is the version you have in gradle.files.
I am unable to run the unit test when I import org.hamcrest.Matchers as I need lessThan(). My instrumentation tests compile properly while using the greaterThan matcher but not the unit tests
Code:
import org.hamcrest.CoreMatchers.*
import org.hamcrest.Matchers.lessThan
import org.junit.Assert.assertThat
import org.junit.Test
import java.util.*
Gradle Logs: https://pastebin.com/ibgzzrg1
Removing the 2nd line makes the project compile and runs the test.
In my case, I received a compiler error "Unresolved reference: Matchers" while running the Task :compileTestKotlin. It turned out that I had declared the hamcrest dependency as testRuntimeOnly. Changing it to testImplementation fixed the issue.
testImplementation("org.hamcrest:hamcrest:2.2")
It is interesting to check out the documentation here.
I had this same issue. What I was finding was that I was only experiencing this issue with instrumented tests. Non-instrumented tests were able to import and run fine.
What fixed this for me was adding androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' to my dependencies.
I had removed this thinking it wasn't necessary, since none of my tests explicitly use Espresso. Turns out it is, for reasons beyond my understanding.
I've migrated an Eclipse example to Androidstudio gradle type project.
I've added twitter4j libraries to module build.gradle:
dependencies {
compile 'org.twitter4j:twitter4j:4.0.3'
compile 'org.twitter4j:twitter4j-core:4.0.3'
compile 'com.twitter:hbc-twitter4j-v3:1.4.2'
compile 'org.twitter4j:twitter4j-http2-support:4.0.3'
}
It's importing twitter4j classes, but not these ones:
import twitter4j.http.AccessToken;
import twitter4j.http.RequestToken;
It says cannot resolve symbol http
I've tried importing the twitter4j.http but nothing I just can't make it work.
I'm using:
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
Anybody can shed some light on this?
I've looked for hours but no solution yet :(
Thanks in advance!
AccessToken is in the twitter4j.auth package. I assume there is a similar problem with your other classes. It appears that the package structure has been rearranged from earlier versions. I suggest you bookmark the twitter4j JavaDocs and refer to them regularly.
I am 'lucky' to have been charged with maintaining a program developed by someone else, and I come across the following problem with an import statement:
import com.fizzbuzz.android.dagger.InjectingDialogFragment;
which Android Studio cannot resolve. I am totally new to dagger...
I have the following in build.gradle dependencies:
compile 'com.fizz-buzz:fb-android-dagger:1.0.1'
compile 'com.fizz-buzz:fb-android-bluetooth:1.0.3'
InjectingDialogFragment is not available in the version you are currently using. Please use compile 'com.fizz-buzz:fb-android-dagger:1.0.3' instead.
For better understating on how Dagger works you can use this blog http://antonioleiva.com/dagger-android-part-2/
I am new to Android development. I am learning to use Parse.com backend service and get stuck early on.
I am following tutorial to create application that uses Google Maps Android API v2. What I've done :
download sample
project from parse
Import AnyWall-android\Anywall folder from downloaded project to Android Studio
Rebuild project
Then I get a bunch of errors here :
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.location.LocationClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap.CancelableCallback;
import com.google.android.gms.maps.GoogleMap.OnCameraChangeListener;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.Circle;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
common, location, and maps highlighted red. The question is how to resolve these errors?
I appreciate any kind of help or direction (What should I check? Is it about missing library? If it is, what library should I add and where to get it?)
Can't find the class com.google.android.gms.location.LocationClient (android)
There is some problem with the last GPS lib. You have to use an older version than the latest(6.+). Try with an older version. I didn't see anything inside the doc deprecated or missing about the LocationClient.class...
compile 'com.google.android.gms:play-services:5.+'
I think the best solution is, add compile API on your Gradle. services-location has this method.
compile 'com.google.android.gms:play-services-maps:9.8.0'
compile 'com.google.android.gms:play-services-location:9.8.0'
if you wish to include other services, please refer here:
https://developers.google.com/android/guides/setup (scroll down)
Google Play Services is now modular, you can select the packages you want from it.
To get analytics add:
compile 'com.google.android.gms:play-services-analytics:7.3.0'
to you build.gradle's dependencies section
P.S
replace 7.3.0 with new version as they arrive, or replace with "+" to always get the latest
Android Studio is complaining that it can't find the Play Services library.
Follow the steps here to ensure Google Play Services SDK is installed (specifically, make sure 'Google Repository' is installed along with 'Google Play Services'): http://developer.android.com/google/play-services/setup.html#Install
Then, make sure the following is added to the dependencies{} block in your build.gradle:
compile 'com.google.android.gms:play-services:+'
Clean and rebuild.
Add this line you build.gradle in Gradle Scripts folder
dependencies {
compile 'com.google.android.gms:play-services:11.2.0'
}
with this i solved this issue.
Previous answers were correct.
But in gradle:3.0 the compile configuration is now deprecated and should be replaced by implementation or api.
Check out more information in the documentation - API and implementation separation.
Its just a common mistake in my case, I just remove default ""flutter:"" keyword in pubspec file while managing package