簡體   English   中英

無法解決以下問題:Lcom / google / android / gms / common / internal / Preconditions; 在Unity中

[英]Failed resolution of: Lcom/google/android/gms/common/internal/Preconditions; in Unity

我正在開發一個android sdk,可在其中獲取用戶位置。 對於Android應用程序,它運行良好,現在我要使其與Unity兼容。

使用FusedLocationProviderClient client = LocationServices.getFusedLocationProviderClient(context);時出現此錯誤FusedLocationProviderClient client = LocationServices.getFusedLocationProviderClient(context);

E/Unity: AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/Preconditions;
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/Preconditions;
    at com.google.android.gms.common.api.Api.<init>(Unknown Source:2)
    at com.google.android.gms.location.LocationServices.<clinit>(Unknown Source:22)
    at com.google.android.gms.location.LocationServices.getFusedLocationProviderClient(Unknown Source:0)
    at in.___.___..LocationManager.startLocationUpdates(LocationManager.java:43)
    at in.___.___..LocationManager.startLocation(LocationManager.java:33)
    at in.___.___.Main.initialize(Main.java:126)
    at in.___.___.Main.registerAPP(Main.java:83)
    at in.___.___.init(__.java:76)
    at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
    at com.unity3d.player.UnityPlayer$c$1.handleMessage(Unknown Source:151)
    at android.os

我添加了play-services-location,play-services-base等,但無法解決此錯誤。

最后,在這個問題上花了2天后,我解決了。 實際上非常簡單。 當您將aar庫添加到統一庫時,您必須檢查其依賴關系,它將在頁面或pom文件中列出。 因此,當我檢查play-service-location時,我發現它與play-service-basement和play-service-tasks有依賴關系。 因此,當我添加這些aar軟件包時,一切正常。

你可以在這里看到清單

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM