小编Bra*_*don的帖子

启用配置缓存会导致构建失败

我刚刚升级了我们的项目以使用 gradles 构建和配置缓存来帮助构建速度。但是当运行这个命令时构建失败

gradlew dependencies --stacktrace --scan
Run Code Online (Sandbox Code Playgroud)

我的 gradle.properties 文件中有这个

org.gradle.unsafe.configuration-cache=true
Run Code Online (Sandbox Code Playgroud)

这是我收到的错误

FAILURE: Build failed with an exception.

* What went wrong:
Configuration cache problems found in this build.

2 problems were found storing the configuration cache.
- Task `:dependencies` of type `org.gradle.api.tasks.diagnostics.DependencyReportTask`: cannot serialize object of type 'org.gradle.api.artifacts.Configuration' as these are not supported with the configuration cache.
  See https://docs.gradle.org/7.0/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
- Task `:dependencies` of type `org.gradle.api.tasks.diagnostics.DependencyReportTask`: invocation of 'Task.project' at execution time is unsupported.
  See https://docs.gradle.org/7.0/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?或者是什么导致了这个问题?我真的不知道在哪里进行故障排除,因为我不知道这是否是我的 gradle 配置中的错误。

完整的堆栈跟踪 …

android gradle build.gradle android-gradle-plugin gradle-plugin

37
推荐指数
3
解决办法
2万
查看次数

FusedLocationClient 不调用 onLocationResult

我目前正在创建一个位置客户端,目前我有

 public void startUpdatingLocationProcess(Context context) {

     parentContext = context;

    if (mFusedLocationClient == null){
        mFusedLocationClient = LocationServices.getFusedLocationProviderClient(parentContext);

        LocationRequest mLocationRequest = new LocationRequest();
        mLocationRequest.setInterval(5000);
        mLocationRequest.setFastestInterval(5000);
        mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);

        if (ContextCompat.checkSelfPermission(parentContext, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)
        {
            mFusedLocationClient.requestLocationUpdates(mLocationRequest, new LocationCallback(){
                @Override
                public void onLocationResult(LocationResult locationResult) {

                    onLocationChanged(locationResult.getLastLocation());
                }

            } , Looper.myLooper());

         }


}
Run Code Online (Sandbox Code Playgroud)

这是在我想在整个应用程序生命周期中运行的 LocationApi 类中,这个特定的应用程序运行许多活动,所以我不想在每次销毁和创建新活动时“重新创建”请求。

允许并检查 FINE_LOCATION 的权限,logcat 中没有错误,代码在创建 mFusedLocationClient 对象时运行 requestLocationUpdates 方法,但它从不调用“onLocationResult”方法。

使用这个 api 有什么我遗漏的吗?

android fusedlocationproviderclient

7
推荐指数
1
解决办法
7465
查看次数

Jetpack Compose ClipToPadding

我知道我可以像这样向小部件添加填充

LazyColumn(
   modifier = Modifier.padding(0.dp, 0.dp, 0.dp, 10.dp),
   content = {
        items(items.size) { index ->
            EmergencyContactComposeItem(emergencyContact = items[index])
        }
    }
)
Run Code Online (Sandbox Code Playgroud)

但是我如何产生与“clipToPadding=false”相同的结果

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:clipToPadding="false"
    android:paddingBottom="25dp">
Run Code Online (Sandbox Code Playgroud)

视图/小部件在哪里不会剪切填充,但仍然强制执行边界?

android kotlin android-jetpack android-jetpack-compose

3
推荐指数
2
解决办法
942
查看次数