java.io.filenotfoundexception:/home/ljh/.android/analytics.settings(权限被拒绝)

时间:2016-11-24 16:14:54

标签: android android-studio-2.2

当我开始使用Android工作室时,我得到了

  

无法初始化分析,视为选择退出。 java.io.filenotfoundexception:/home/ljh/.android/analytics.settings(权限被拒绝)

我该怎么办?我的操作系统是Ubuntu 32bit

2 个答案:

答案 0 :(得分:0)

解决方法是在你的ubuntu盒子上安装这些32位库

sudo dpkg --add-architecture i386
sudo apt-get -qqy update
sudo apt-get -qqy install libncurses5:i386 libstdc++6:i386 zlib1g:i386

以下是通过发出上述命令解决的编译错误:

:CordovaLib:generateReleaseResources
:CordovaLib:packageReleaseResources
   Building Cordova app for Android          \
:CordovaLib:generateReleaseBuildConfig
 FAILEDding Cordova app for Android          \

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':CordovaLib:processReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

堆栈跟踪也可能会显示这些错误

BUILD FAILED

Total time: 37.372 secs
%% Command finished with error code 1: /home/stens/src/github.com/loudthink/loudspeed/.meteor/local/cordova-build/platforms/android/gradlew cdvBuildRelease,-b,/home/stens/src/github.com/loudthink/loudspeed/.meteor/local/cordova-build/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Dorg.gradle.jvmargs=-Xmx2048m,-Pandroid.useDeprecatedNdk=true
=> Errors executing Cordova commands:

   While building Cordova app for platform Android:
   Error: /home/stens/src/github.com/loudthink/loudspeed/.meteor/local/cordova-build/platforms/android/gradlew: Command failed with exit code 1
   Error output:
   Could not initialize analytics, treating as opt-out.
   java.io.FileNotFoundException: /home/stens/.android/analytics.settings (No such file or directory)

答案 1 :(得分:0)

也许它有root权限,而不是你的用户。

您可以看到在第二个命令中,root是文件夹的所有者。 我将其更改为我的用户,它可以正常工作。

lucas@ubuntu$ ls /home/lucas/.android/
ls: no se puede abrir el directorio '/home/lucas/.android/': Permiso denegado

lucas@ubuntu$ ls -lart /home/lucas/ | grep android
drwxr-x---   2 root root     4096 sep 14 14:02 .android

lucas@ubuntu$ sudo chown lucas:lucas /home/lucas/.android/
[sudo] password for lucas: 
Fingerprint Login 1.09
Authenticating lucas
Swipe your finger or type your password:

lucas@ubuntu$ ls /home/lucas/.android/
adbkey  adbkey.pub  analytics.settings
lucas@LUCAS-ITECNIS:~/itecnis/simple/usuarios$ ls -lart /home/lucas/ | grep android
drwxr-x---   2 lucas lucas     4096 sep 14 14:02 .android