我们有一个android gradle项目.今天我想将android构建工具版本从20升级到21.0.1,但现在aapt失败了.
* What went wrong:
Execution failed for task ':myproject-android:processDebugResources'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
c:\_DEVELOP\AndroidSDK\sdk\build-tools\21.0.1\aapt.exe package -f --no-crunch -I c:\_DEVELOP\AndroidSDK\sdk\platforms\android-16\android.jar -M D:\_MY_PROJECT\trunk\myproject_bin\gradle\build\re
lease\myproject-android\intermediates\manifests\full\debug\AndroidManifest.xml -S D:\_MY_PROJECT\trunk\myproject_bin\gradle\build\release\myproject-android\intermediates\res\debug -A D:\_MY_PROJECT\tr
unk\myproject_bin\gradle\build\release\myproject-android\intermediates\assets\debug -m -J D:\_MY_PROJECT\trunk\myproject_bin\gradle\build\release\myproject-android\generated\source\r\debug -F D:\_PIVOSC
ORE_P4\trunk\myproject_bin\gradle\build\release\myproject-android\intermediates\res\resources-debug.ap_ --debug-mode --custom-package com.myproject.app -0 apk --output-text-symbols D:\_MY_PROJECT\trunk\
myproject_bin\gradle\build\release\myproject-android\intermediates\symbols\debug
Error Code:
255
Run Code Online (Sandbox Code Playgroud)
我有一些警告说:
libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
Run Code Online (Sandbox Code Playgroud)
我修复了这些,但在appcompat-v7库中还有6个.
如果我将构建工具版本恢复为20,一切正常.
有人遇到过这个问题吗?
我想做这样的事情:
当我的应用程序启动时,我想启动一个应检查我的位置的服务
当应用程序进入后台时,我想停止服务
我有两个主要问题:
如何检测到我的应用程序转到后台?我有几个活动,我在我的MainActivity中尝试覆盖onPause,但是当我开始其他活动时也会调用onPause.
这个问题更重要:我的服务如何检查我的位置是什么样的?我尝试了几种方法,但没有成功.
我的服务看起来像这样,但它不起作用.我应该改变什么来使它工作?
package com.pivoscore.service;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.IBinder;
public class LocationService extends Service {
private LocationListener locationListener;
@Override
public IBinder onBind(final Intent intent) {
return null;
}
@Override
public int onStartCommand(final Intent intent, final int flags, final int startId) {
super.onStartCommand(intent, flags, startId);
return Service.START_STICKY;
}
@Override
public void onCreate() {
super.onCreate();
final LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
this.locationListener = new MyLocationListener();
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, …Run Code Online (Sandbox Code Playgroud) 我知道使用-Werror和-Xfatal-warnings我可以将警告视为错误,但是仍然可以在编译输出中看到所有警告,但只会使其中一些成为错误?
我有一个ANTLR 4语法:
grammar Test;
start : NonZeroDigit '.' Digit Digit? EOF
;
DOT : '.' ;
PLUS : '+' ;
MINUS : '-' ;
COLON : ':' ;
COMMA : ',' ;
QUOTE : '\"' ;
EQUALS : '=' ;
SEMICOLON : ';' ;
UNDERLINE : '_' ;
BACKSLASH : '\\' ;
SINGLEQUOTE : '\'' ;
RESULT_TYPE_NONE : 'NONE' ;
RESULT_TYPE_RESULT : 'RESULT' ;
RESULT_TYPE_RESULT_SET : 'RESULT_SET' ;
TYPE_INT : 'Int' ;
TYPE_LONG : 'Long' ;
TYPE_BOOL : 'Bool' ; …Run Code Online (Sandbox Code Playgroud) 我最近开始使用基本操作系统。它基于 Ubuntu。在安装过程中,它会安装 python 3.6。
我通过安装以下软件包手动安装了 python 3.8:python3.8, python3.8-dev, python3.8-minimal, python3.8-venv. 我还更新了 python 二进制文件的链接:
sudo ln -sf /usr/bin/python3.8 /usr/bin/python3
Run Code Online (Sandbox Code Playgroud)
在此之后,一些事情停止了。例如,当我尝试执行一个不存在的命令时,它没有打印找不到命令的错误消息,但它显示了 python 堆栈跟踪。我解决的那个:
cd /usr/lib/python3/dist-packages
sudo ln -s apt_pkg.cpython-36m-x86_64-linux-gnu.so apt_pkg.so
sudo ln -s apt_inst.cpython-36m-x86_64-linux-gnu.so apt_inst.so
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,python 错误是因为它找不到 apt 模块的已编译二进制文件。
所以这个问题解决了,但是有几个类似的问题,没有一个可以通过这种方式解决,因为模块二进制文件与 python 3.8 不兼容。
是否可以完全删除 python 3.6 并用 3.8 覆盖它,以便模块二进制文件也得到更新?或者python 3.8和3.6可以共存吗?我可以使用/usr/bin/python3指向 python 3.6的链接,我会手动执行/usr/bin/python3.8或为其创建不同的别名或链接。但是,当我打印出来时sys.path,/usr/bin/python3.8我得到了这个:
/usr/lib/python38.zip
/usr/lib/python3.8
/usr/lib/python3.8/lib-dynload
/home/{username}/.local/lib/python3.8/site-packages
/usr/local/lib/python3.8/dist-packages
/usr/lib/python3/dist-packages
Run Code Online (Sandbox Code Playgroud)
麻烦的是最后一个。这就是模块与 3.6 兼容的 so 文件所在的位置。我能否以某种方式强制 python 3.8 完全忽略最后一个模块搜索路径(而不总是在我的脚本中声明 sys.path.remove)?
android ×2
antlr ×1
antlr4 ×1
antlrworks2 ×1
build-tools ×1
gradle ×1
grammar ×1
java ×1
lexer ×1
location ×1
python ×1
python-3.x ×1
scala ×1
ubuntu ×1
warnings ×1