Dependency = [com.google.android.gms: google-play-services: apklib: 7: compilation] not found in workspace

Sorry for adding another question, โ€œGoogle Maps Dependency Dependent on Google Android Dependency,โ€ but I think I read most of the posts about this and did not use all the proposed solutions without success.

I have an Android maven project that works fine, with a Google Maps V2 dependency that is not referenced using maven, but through the google-play-services_lib project, imported depending on the workspace and the attenuation of the capitalization library.

Now I am trying to configure the dependency of google-play-services via pom, since I am implementing automated maven tests with Robolectric, but I am stuck in this error shown in the first line of pom, without a quick fix:

dependency = [com.google.android.gms: google-play-services: apklib: 7: compilation] not found in workspace

What I have tried so far, after many searches and checking the results after each step without success:

  • Initially installed google play services components in my local .m2 repository using android-maven-sdk-helper (after these instructions ) and add two dependencies to jar and apklib version 7 in my pom project, which is my locally installed version (like here ) . After that, it should have worked, but a dependency error appeared.

  • Remove the link to the google-play-services_lib library (in project / preferences / Android / Library) from the eclipse build path. In any case, the google-play-services_lib project is still in the workspace.

  • Copy apklib from my local m2 storage to some place in the workspace: I tried google-play-services_lib / bin, google-play-services_lib / libs, MyProject / libs. Tested using the name google-play-services-7.apklib (as in the repository file) and google-play-services.apklib.

  • The "Mavenise" google-play-services_lib project included in the workspace by running the Eclipse Configure / Convert to Maven project. I edited the created pom to upgrade the packaging type to apklib: <packaging>apklib</packaging> , and the android-maven-plugin module with <extensions>true</extensions> added to recognize the apklib package type. I compiled the project with the maven target compilation with success, but I cannot find the generated apklib file anywhere.

After each of these changes, I make a Maven / Update project, clear the project, even restart Eclipse. Not successful: a dependency not found in the whitespace error still exists.

I do not know what else to try. Maybe this is something with the name of the library? The name of the library project is google.play-services_lib, with the suffix _lib, and the jar specified in the build path of the eclipse android library is _lib.jar, but maven artifacts do not have the suffix _lib. I also tried renaming components and artifacts without success, but I think the problem might be there. Can someone send a pom.xml example for the mavenized google-play-services_lib project?

Another suggestion: when I compile the mavenized library project, why can't I find the generated .apklib file, where is it? I checked the trace using mvn -X compilation and did not find a hint.

Environment and Versions:

 Eclipse Indigo External maven 3.0.5 (embedded Maven 3.0.3 not used) android-maven-plugin 3.6.0 maven-eclipse-plugin 2.8 m2e-android plugin (m2eclipse android integration) 0.4.2 Android API level 13 

pom.xml I added google-play-services_lib to the project:

 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>google-play-services_lib</groupId> <artifactId>google-play-services_lib</artifactId> <version>7</version> <packaging>apklib</packaging> <properties> <android-platform>13</android-platform> <android-emulator>13</android-emulator> <android-maven-plugin-version>3.6.0</android-maven-plugin-version> <maven-compiler-plugin-version>3.0</maven-compiler-plugin-version> <java-version>1.6</java-version> <local-sdk-path>C:\NoProgramFiles\Android\android-sdk</local-sdk-path> </properties> <build> <finalName>${project.artifactId}</finalName> <plugins> <plugin> <groupId>com.jayway.maven.plugins.android.generation2</groupId> <artifactId>android-maven-plugin</artifactId> <version>${android-maven-plugin-version}</version> <configuration> <sdk> <path>${local-sdk-path}</path> <platform>${android-platform}</platform> </sdk> <emulator> <avd>${android-emulator}</avd> </emulator> <deleteConflictingFiles>true</deleteConflictingFiles> <undeployBeforeDeploy>true</undeployBeforeDeploy> </configuration> <extensions>true</extensions> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>${maven-compiler-plugin-version}</version> <configuration> <source>${java-version}</source> <target>${java-version}</target> </configuration> </plugin> </plugins> </build> 

+4
source share
2 answers

Finally, the problem was that the names of the artifacts and the apclib are not generated in the apk library project. Here is what was wrong:

  • The groupId and artifactId names in the pom library were incorrect: they must match the name provided in the error message (I should have read it more carefully).

Valid Values:

 <groupId>com.google.android.gms</groupId> <artifactId>google-play-services</artifactId> 

Instead of the generated eclipse when converting the project to maven, which were based on the project name:

 <groupId>google-play-services_lib</groupId> <artifactId>google-play-services_lib</artifactId> 
  • apklib is not generated using mvn compile , mvn package is right for it. Thus, the apklib file is created in the target folder of the project library.

So m2e-android 0.4.2 supports apklib dependency with apklib mavenized gokl-play services, although the library project should still be included in the workspace.

Final note. I had errors while performing actions with cards in a real device:

 07-08 09:42:45.170: W/dalvikvm(27953): VFY: unable to resolve virtual method 4296: Lcom/google/android/gms/maps/GoogleMap;.setMapType (I)V 07-08 09:42:45.180: E/dalvikvm(27953): Could not find class 'com.google.android.gms.maps.SupportMapFragment', referenced from method mypackage.MyMapActivity.setUpMapIfNeeded 07-08 09:42:45.180: W/dalvikvm(27953): VFY: unable to resolve check-cast 801 (Lcom/google/android/gms/maps/SupportMapFragment;) in Lmyapp/MyMapActivity; 07-08 09:42:45.180: E/dalvikvm(27953): Could not find class 'com.google.android.gms.maps.SupportMapFragment', referenced from method mypackage.MyMapActivity.onCreate 07-08 09:42:45.200: E/AndroidRuntime(27953): java.lang.RuntimeException: Unable to start activity ComponentInfo{mypackage/mypackage.MyMapActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment 

It seems that the map library was not included in the apk app. My fix: in google-play_services_lib Project eclipse Properties / Java Build Path / Order and Export tab I checked the Android Private Libraries checkbox, so the original google maps banner is installed on a working device.

+1
source

If the problem persists when resolving name mismatch (the same name in the pom and project pom libraries), after updating the maven project (project explorer, right-click any project -> maven-> update maven project), try just deleting this message (!! )

I problem, right-click on the error message and select "Delete." Worked for me and for Kevin Peck - Eclipse dependency not found in workspace fix

+1
source

Source: https://habr.com/ru/post/1489641/


All Articles