troubleshooting debug problems in flutter - java

I experienced a problem in this section Could not determine the dependencies of task': app: compileProfileJavaWithJavac
I have searched various sources but have not found a solution, and I use the flutter framework.
I have tried various ways such as searching for references related to my problem, but I did not find a solution, either on github, stackoverflow and also flutter.
Could not determine the dependencies of task ':app:compileProfileJavaWithJavac'.
Could not resolve all task dependencies for configuration ':app:profileCompileClasspath'.
Could not find androidx.legacy:legacy-support-v4:28.0.3.

You have to migrate to AndroidX.
Go to your android/gradle.properties and add this line of code:
android.useAndroidX=true
This will make sure to use the AndroidX library instead of the Support library.
EDIT:
You may also want to add android.enableJetifier=true which enables you the Jetifier, i.e: a set/collection of libraries to make developer's life easier. For more info. look here.

Related

Updating gradle to version 5.1.1 causes `Unresolved reference:` issues

I updated the Gradle plugin version from 3.3.2 to 3.4.0 and Gradle to version 5.1.1. I know for sure this causes a library to be unknown when I import it. It gives the error unresolved reference.
Cleaning the project, rebuilding, Invalidate caches/Restart and throwing away the .idea file all do not solve this issue. The only thing that worked for me was restoring the Gradle version back to 3.3.2. But this is not what I want.
The problem I have has to do with ROS libraries; ROS Java bootstrap's message_generation to be specific. This library has the same relative path as the rosjava library; namely org.ros.*. I am not sure if this has anything to do with the issue.
What can I do about this? Thanks a lot: all help is very welcome!
The solution was described on the Gradle github issue page where I also described my problem. What is described is that ROS is publishing the wrong metadata.
"This says that you only need the jar that contains org.ros.internal.message.Message when running your application and not when you're compiling it, which doesn't seem to be the case. To fix this, you'll need to add the extra dependencies that ROS isn't including for compilation."
I fixed it like described; I added the dependencies corresponding to the libraries that were not found after the update. This did the trick for me:
implementation 'org.ros.rosjava_messages:sensor_msgs:1.12.5'
implementation 'org.ros.rosjava_bootstrap:message_generation:0.3.3'
implementation 'org.ros.rosjava_messages:std_msgs:0.5.11'
implementation 'org.ros.rosjava_messages:geometry_msgs:1.12.7'

Gradle: List deprecated features

I am getting a warning about the usage of deprecated features in my build.
Is there a way to list all the deprecated features so that I may go through and update my code?
*clarification
I know I can go to the Gradle documentation and see what is now deprecated, what I would specifically like is a way to go through MY code and list MY deprecated features.
I just faced the exact same problem and running the Gradle build task every time through the command line wasn't the best option for me because, during development, I usually just use the built-in Gradle build task run, so:
I know I can go to the Gradle documentation and see what is now deprecated, what I would specifically like is a way to go through MY code and list out MY deprecated features.
You can do this by adding the mentioned --warning-mode=all flag to your gradle command line options in your Android Studio settings:
This will print the proper warnings for you to be aware of what are the specific deprecated features your app is using.
Also, I know you asked this near a year ago, but, it might be useful for other people facing the same issue.
In order to change the warning verbosity level in the Android Studio IDE, you can add the option org.gradle.warning.mode=(all,none,summary) to the gradle.properties file, which can be found in the root directory of your project.
Add following line to set the warning mode to all:
...
org.gradle.warning.mode=all
...
Use Gradle option -Dorg.gradle.warning.mode=(all,none,summary) to control verbosity, for example, mode all will log all warnings with detailed descriptions:
./gradlew build -Dorg.gradle.warning.mode=all
More details can be found in the official documentation: Showing or hiding warnings
Go to the build.Gradle (Module) file.
replace Compile with implementation.
Sync the gradle file and you will not receive the warning again.

Migrating Eclipse Project to Android Studio with dependencies

Imported an Eclipse Project to Android Studio having library dependencies of Sliding Menu, ViewPager, PullToRefresh. Import was successful but after syncing grade files getting duplication errors in values.xml.
~/app/build/intermediates/res/merged/debug/values/values.xml
Can anyone suggest me how to resolve this issue?
Please make sure that you migrated your project in a standard way. You should use Android migration tools for this. Then, it will give you a summary of changes and failures. So, you can spot your issue and find its solution. Make sure you keep the default setting in order to make a clean Android studio project. Please follow this post step by step and let me know if you still have issue.
https://stackoverflow.com/a/36533889/5475941
I hope it helps.

Gradle and adding github projects as dependencies, some clarifications

I am pretty new to Gradle, I followed some tutorials and read around wikis and guides but I still have some questions I couldn't clearly find an answer for.
What I'd like to have are some clarifications about Gradle and general github project dependencies.
Reading this question, he mentions the following example:
dependencies {
mavenCentral()
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+'
}
I get com.github.chrisbanes.actionbarpulltorefresh, it is basically com.github.username.repository, but what do exactly represent extra-abc and the +?
On the gradle irc they said the first one is the artifact and they gave me this, where it says: Dependency configurations are also used to publish files.. but I still don't get.. which files and for which purpouse you want to do that? I guess artifacts should refer to jars, but why giving it a name (extra-abc)?
+ takes the place where the version usually is, so I assume it should indicate the latest version, shouldn't it?
Moreover, is the example I pasted valid for both gradle and plain (netbeans) projects hosted on github or do we have to differentiate?
I am using Netbeans 8.02 with the gradle plugin.
Sorry for the dumb questions, but I really want to clear my doubts.
First of all, this library is NO LONGER BEING MAINTAINED. You should use the support library.
I get com.github.chrisbanes.actionbarpulltorefresh, it is basically com.github.username.repository,
It is not correct.
This library is published on Maven Central.
The com.github.chrisbanes.actionbarpulltorefresh is the groupId of the artifact that you can find on Maven.
but what do exactly represent extra-abc
The extra-abc is the name of the artifact (the name of the library...) on Maven.
Here you can find the full list.
|GroupId |ArtifactId| Latest Version|
|--------------------------------------------|----------|-----------------|
|com.github.chrisbanes.actionbarpulltorefresh|library | 0.9.9|
|com.github.chrisbanes.actionbarpulltorefresh|extra-abs | 0.9.9|
|com.github.chrisbanes.actionbarpulltorefresh|extra-abc | 0.9.9|
and the +
It indicates to gradle to use the last version.
In your case you can use one of these:
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+'
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:0.+'
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:0.9.+'
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:0.9.9'
Pay attention, the use of + is not in general a good idea, because you can't know what version you are using.
In this case, since the library is deprecated it is not a problem.
EDIT
If the question is how can I add a github project that is not present on the maven repo as a reference to my project then?
Pls refer to this answer:

How to get all transitive dependencies programatically

I have seen many posts on this, but let me say that i am not trying to write a plugin.
I am making a project analyser which needs to find out resolved dependencies with their path.
Given a pom.xml(in a project) i want to find out all the dependencies(transitive too) with their paths and if possible the missing dependencies too.
Getting a version independent solution would be bonus.
PS: Every answer is suggesting to use exec to run the command on cli, i am already using this and want to find a better approach of doing this.
You could use the maven dependency plugin. The two that I have used and found very helpful I've mentioned below:
dependency:tree
Displays a tree structure of the entire dependencies both direct and transitive used. Be sure to use the verbose mode.
Link
dependency:list
Displays all dependencies used in a project in a list fashion. I personally do not find this that handy at times when I need to know what are transitives and which are direct for licensing purpose. But it has its place when you just need to know what you are using or detecting duplicate libraries with different versions.
Link
In addition there is also analyze, when reading the documentation it seems quite handy but I would need to try this out and I will.
dependency:analyze
Use mvn dependency:tree. For programmatic access simply use the java Process api.
http://maven.apache.org/plugins/maven-dependency-plugin/tree-mojo.html
Java Process with Input/Output Stream
Also Maven plugins are simple java classes. You can download the dependency:tree plugin's code and use it/modify it to your taste.

Categories

Resources