HERE maps Android: where is the RouteManager class? - java

trying to integrate a HERE map into my application. I have a trial key for now.
Cant seem to find RouteManager. Its not on the classpath:
The only thing I have found is a class named "RouteManagerImpl":
Here is RouteManager in the SDK documentation:
https://developer.here.com/documentation/android-starter/topics_api_nlp/com-here-android-mpa-routing-routemanager.html
Any ideas why is this?

In the Premium Edition of the HERE SDK, this was renamed some time ago to CoreRouter. RouteManager is only the name in the StarterSDK.
You should use the Premium documentation instead: https://developer.here.com/documentation/android-premium/topics/routing.html

It might be a bit late to answer your question, But this scenario caused because I try to replace Premium-SDK (AAR file) with Starter-SDK and then Gradle build started failing with error Cannot find the package... even if I can see the Decompiled version of RouteManager class from AS.
Anyway, Following steps worked for me:
Delete the HERE-sdk.aar from 'libs' folder.
Remove the implementation(name:'HERE-sdk', ext:'aar') dependency from app-level build.gradle file.
Clear your project.
Download the latest HERE SDK from developer console and copy it into the 'libs' folder.
Add the implementation(name:'HERE-sdk', ext:'aar') dependency after the implementation fileTree(include: ['*.jar'], dir: 'libs') (in case if you have any JAR added).
Clean & Rebuild the project.
That's it. You can now import RouteManager class in your app.

Related

Why can't com.google.inject.Singleton be found when I have the Google Guice library added to the project?

I want to add Google Guice to my multi-module Gradle project. So I added this to the relevant module's build.gradle file:
implementation group: 'com.google.inject', name: 'guice', version: '5.1.0'
When I build it, the files download and it shows:
Build successfull
But then when I want to use it, for example I add
import com.google.inject.Singleton;
it reports:
Cannot resolve symbol 'google'
I use IntellijIDEA.
I don't know much about it, so I would appreciate it if someone could explain to me what I'm doing wrong or how to correctly add this library to the project.

Use provided/compileOnly dependency with Android libraries

For a project, I have this type of structure :
--- app => my Android application
|
\- lib => my Android library
The application use methods from the lib, but I want a build without embedding classes from the lib (since they are also available in a custom AOSP build), which could be done with provided/compileOnly directive for dependencies. The problem is that this directive doesn't work with aar librairies generated by the Android plugin, only with jars.
I found a way to build also jar files by using the custom makeJar task found here :
Build library jar with Gradle
Then in the build.gradle for the application, I can add a dependency like this :
dependencies {
compileOnly fileTree(dir: '../lib/build/outputs/jar', include: ['*.jar'])
...
}
This works fine, but only if the jar has already been generated by a previous build, which means I have to launch ./gradlew build two time to make it work.
I suppose the problem is that unlike regular dependencies (ie compileOnly project(':lib')), the fileTree dependency is evaluated without requesting a build of the sub project and on the first build, no jar file is added to the classpath.
I tried things like preBuild.dependsOn(':lib:makeJar') but without success because it's executed after evaluation.
I can't switch lib to Java plugin because it's Android specific code and I need to build aar for other projects, so is there a better way to use the compileOnly directive with this module ? Or maybe a way to force the lib to be built before the app build.gradle is evaluated ?
add this on your build.gradle(app)
compile fileTree(include: ['*.jar'], dir: 'libs')
or directly compile your jar file as following
compile files('libs/your_filename_in_libs_folder.jar')

Android Dependency Issue

Trying to run my app, this is an error I'm getting from the Gradle Build:
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
Could not find any version that matches com.google.android.gms:play-services-vision:9.4.0.+.
Versions that do not match:
11.0.2
11.0.1
11.0.0
10.2.6
10.2.4
+ 17 more
Required by:
project :app
Here's what my dependencies look like:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// Important - the CameraSource implementation in this project requires version 8.1 or higher.
compile 'com.android.support:support-v4:24.2.0'
compile 'com.google.android.gms:play-services-vision:9.4.0.+'
compile 'com.android.support:design:24.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
I've tried to update the play services through Tools>Android SDK>..
I've read some other posts and people have similar problems, but the fixes don't work. I was also hoping to understand the issue a bit more.
Thanks
Try :
A full clean and rebuild
Uninstalling/installing android support repository
Your specification of "9.4.0.+" is not correct. Maybe you meant something like "9.4.+", but at any rate dynamic dependencies aren't a great idea IMHO. The error message lists the most recent version available on your machine as "11.0.2" (which is the most recent version at the time of writing). Use that instead. According to your comment above, this part of your problem is clearly resolved.
As to your other problem ("support libraries must use the same version"), something (play-services-vision or constraint-layout) most likely pulls in a different version of some part of the support libraries. You should look at this SO question to track down where your dependencies are coming from. You will need to make sure and use compatible versions of everything. In the end, it may suffice to just make sure you have the latest version of each.

Stetho-Timber library issue with new Timber version 4.1.2

While I was trying to use stetho-timber Library in my Android application I faced this problem:
Error:Module 'com.facebook.stetho:stetho-timber:1.3.1' depends on one
or more Android Libraries but is a jar
What's wrong?!
After inspecting in its codes I found that it uses timber v3.0.1!
Just add this to your build.gradle dependencies tag to exclude timber within the stetho library,
cause it is an old version and conflicts with new one:
dependencies {
compile ("com.facebook.stetho:stetho-timber:1.3.1") {
exclude group: "com.jakewharton.timber", module: "timber"
}
.
.
.
I have recently found Facebook Stetho Library and using it is fantastic, give it a try! :)

multiple dex files define landroid/support/annotation/AnimRes

The moment I added the android support annotations to my dependencies
compile 'com.android.support:support-annotations:20.0.0'
I got this error:
Error Code:
2 Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
build.gradle
android {
compileSdkVersion 19
buildToolsVersion '20.0.0'
defaultConfig {
minSdkVersion 10
targetSdkVersion 19
}
}
dependencies {
compile 'com.android.support:support-v4:19.0.0'
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'com.android.support:support-annotations:20.0.0'
}
Anybody else experienced this issue? I have tried the solutions from here.
The problem is that android-support-annotations.jar used to be a separate library containing the android annotations, but for some reason these annotations are already included in recent versions of the android-support-v4.jar file.
Deleting the annotations jar solved the issue.
Build->clean Project ,and it worked
I deleted the android-support-v4.jar and it worked.
If this is cordova / ionic project this worked for me
add these line to build.gradle under platforms/android after line number 22 i.e after apply plugin: 'android'
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
Solved this exact issue in a Cordova project that used the facebook plugin. I was able to successfully build by commenting out this line from platforms\android\project.properties, as shown:
# cordova.system.library.1=com.android.support:support-v4:+
And by commenting out this line from platforms\android\build.gradle, as shown:
// compile "com.android.support:support-v4:+"
Then doing the build. The problem started when I installed (katzer/cordova-plugin-local-notifications) which added these lines, but it created a conflict since the library it was adding to the build was already part of the facebook plugin build.
As other users said, the first elements to troubleshoot are dependencies. Although, sometimes you can struggle for hours and you don't find any problem so you can focus on the build process instead.
Changing the way in which the .dex files are produced sometimes solves the problem. You can go through these steps:
Open your Build.gradle (app) file
Search for the task dexOptions
Change it to:
dexOptions {
incremental false
}
If you don't find the task in your file then you can add it.
For me the reason was the new data-binding lib
com.android.databinding:dataBinder:1.0-rc2
it somehow used a conflicting version of the annotations lib, which I could not force with
configurations.all {
resolutionStrategy {
force group: 'com.android.support', name: 'support-v4', version: '23.1.0'
force group: 'com.android.support', name: 'appcompat-v7', version: '23.1.0'
force group: 'com.android.support', name: 'support-annotations', version: '23.1.0'
}
}
but the new rc3 and rc4 versions seem to have fixed it, so just use those versions
I had the same problem , but i deleted build files from the build folder
projectname/app/build
and it removed all the related error. "can't clean the project" and also "dex errow with $anim"
I managed to fix this issue. The reason was that I included the android support library 19.0.0 as a dependency, but 19.1.0 is required. See here for more information
So it has to be
dependencies {
compile 'com.android.support:support-v4:19.1.0'
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'com.android.support:support-annotations:20.0.0'
}
If you import AppCompat as a library project and you also have android-support-annotations.jar in libs elsewhere, make sure to import everywhere AppCompat library only (it already includes this annotations lib). Then delete all android-support-annotations.jar to avoid merging multiple versions of this library.
Updating Android SDK Tools fixed it for me, now it just sees the copy in android-support-v4.jar.
I had the same problem when using ant, and the annotations library was being included automatically by an outdated sdk.dir/tools/ant/build.xml.
Clean project works as a temporary fix, but the issue will reappear on next compilation error.
To fix more reliably, I had to update the dependency to android support-v4 to com.android.support:support-v4:22.2.0.
Put in your build.gradle the dependency of support-annotations according with your compileSdkVersion. For instance: A project with the compileSdkVersion 25 you can put the following dependence:
compile 'com.android.support:support-annotations:25.0.1'
This will solve your problem.
In my case I had a file called cache.xml under /build/intermediates/dex-cache/cache.xml in the root project folder. I deleted this file, rebuild the project and it worked for me.
I deleted the android-support-v4.jar and it worked.
Explain - android-support-v4.jar is conflicting with my other .jar files of project\libs files ** specially when you are running with java 8 on AS.
Put android-support-v4.jar in your libs folder in eclipse. Clean and build the project. It will resolve the issue.
Another reason that messages such as these can come up in Android Studio when building and launching can be the cause of application tags in your libraries.
If you have several Android Library projects that you imported as modules. Go into those projects and remove the <application> ... </application> tags and everything between them. These can cause issues in the build process along with the support library issues already mentioned.
From /platforms/android/libs/
delete android-support-v4.jar.
It works for me.

Categories

Resources