maplibre / maplibre-navigation-android

Maplibre Navigation SDK for Android
MIT License
86 stars 44 forks source link

Unable to run gradle build or gradle check #96

Closed ianthetechie closed 10 months ago

ianthetechie commented 10 months ago

Maplibre Navigation SDK version: 3.0.0 (main branch)

Steps to trigger behavior

  1. Check out the repo
  2. Add some sensible values to developer-config.xml
  3. gradle build or gradle check

Expected behavior

Successful build.

Actual behavior

Lint fails. The initial errors are about missing permissions in the android manifest, which should probably be fixed. A subsequent build complains about missing telemetry providers (which should be missing!).

index f7631a2c..49584957 100644
--- a/libandroid-navigation/src/main/AndroidManifest.xml
+++ b/libandroid-navigation/src/main/AndroidManifest.xml
@@ -4,19 +4,12 @@

     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

     <application>
         <service
             android:name="com.mapbox.services.android.navigation.v5.navigation.NavigationService"
             android:foregroundServiceType="location" />
-        <provider
-            android:name="com.mapbox.android.telemetry.provider.MapboxTelemetryInitProvider"
-            android:authorities="${applicationId}.mapboxtelemetryinitprovider"
-            android:exported="false"
-            android:initOrder="100"
-            tools:node="remove" />
-        <!-- Include the telemetry service to simplify set up (https://www.mapbox.com/telemetry) -->
-        <service android:name="com.mapbox.services.android.telemetry.service.TelemetryService"/>
     </application>

 </manifest>

Applying the above diff allows it to proceed to the next lint stage and it finds 3151 of them 😂

I think we probably need to do one or more of the following, but don't know the history of the project, hence opening an issue rather than a PR straightaway.

boldtrn commented 10 months ago

Regular gradle builds should work fine (they run on CI). After setting your values you should be able to run the sample app with the green play button in Android Studio.

Please feel free to provide a PR if you would like to improve some of the lint warnings or improve the README or CONTRIBUTING :).

ianthetechie commented 10 months ago

Right; I was able to infer that gradle test works via the CI workflows, and the sample app works, but I just can't run gradle build or gradle check as there are lint failures. Is gradle test what we're supposed to run locally when developing the library?

boldtrn commented 10 months ago

Gradle test runs unit tests, you can use this command locally for testing. We should definitely improve this project to improve linter errors, but you can ignore linter errors on the command-line when you run ./gradlew build -x lint.

The default Android Studio build does work without any special configuration.

That said, PRs welcome ;)

ianthetechie commented 10 months ago

PR sent! Thanks for your patience and entertaining my relatively dumb questions as I've never been much of a Java developer and I find gradle itself to be at least as complex as most of the applications developed with it 😂