将旧项目迁移到Gradle 3.1.2的Android插件 [英] Migrating old project to Android Plugin for Gradle 3.1.2

查看:172
本文介绍了将旧项目迁移到Gradle 3.1.2的Android插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个支持Android的大型旧项目.它是在旧的Gradle版本(2.2.3)下开发的.我曾经使用最新的Android Studio,现在尝试将该项目迁移到当前的Gradle版本(3.1.2).

I've got big old project for Android to support. It was developed under old Gradle version (2.2.3). I used to work with the latest Android Studio and now I'm trying to migrate this project to the current Gradle version (3.1.2).

我已经阅读了Google的指南,并从中提出了建议.我设法解决了除两个以外的所有问题.第一个是

I've read guide from Google on this and applied recomendations from it. I managed to fix all issues excepting two. The first one is

警告:配置编译"已过时,并已由实现"和"api"取代.

WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.

我在项目中进行了所有替换,据我所知,这是由依赖项中的库引起的.好的,让我们一起生活吧.但是第二个问题是

I made all replacements in my project and as I understand it's caused by a library from dependencies. OK, let's live with it. But the second issue is

错误:资源android:attr/foregroundInsidePadding是私有的. 消息{种类=错误,文本=错误:资源 android:attr/foregroundInsidePadding是私有的. 来源= [C:\ Users \ alexanderk.gradle \ caches \ transforms-1 \ files-1.1 \ appcompat-v7-25.1.1.aar \ b3fbcbe446f57e45b23f5cfcf67ccbb9 \ res \ values \ values.xml:203:5-69], 原始消息=,工具名称= Optional.of(AAPT)} *

error: resource android:attr/foregroundInsidePadding is private. Message{kind=ERROR, text=error: resource android:attr/foregroundInsidePadding is private., sources=[C:\Users\alexanderk.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.1.1.aar\b3fbcbe446f57e45b23f5cfcf67ccbb9\res\values\values.xml:203:5-69], original message=, tool name=Optional.of(AAPT)}*

Google指南对此进行了以下说明

Google's guide says about this the following

要解决此问题,只需将android:foregroundInsidePadding替换为foregroundInsidePadding.

没关系,我打开问题文件values.xml,转到第203行,...很惊讶,这里没有前台.而且,整个xml中没有这个词.我尝试使Gradle缓存无效,但在Gradle重新创建缓存后,该问题再次出现.我不能忽略这一点,因为这个问题停止了.

That's OK, I open the problem file values.xml, go to line 203 and... surprise, no foregroundInsidePadding here. Moreover, there is no this word in the whole xml. I tried invalidate Gradle cache but the issue appears again after Gradle recreates cache. And I can't ignore this since this issue stop building.

有什么办法解决这个问题吗?

Any ideas how to solve this?

推荐答案

appcompat-v7-25.1.1.aar\b3fbcbe446f57e45b23f5cfcf67ccbb9\res\values\values.xml

看起来它抱怨的不是您项目中的values.xml而是appcompat库中的一个.尝试增加支持库的版本

Looks like it complains not about values.xml in your project but about one within the appcompat library. Try to bump support library version

这篇关于将旧项目迁移到Gradle 3.1.2的Android插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆