我正在使用Android Studio 0.8.9
最近,我在将Eclipse项目迁移到Android studio项目的过程中。我从File -> Import Project...
我遇到一个非常奇怪的问题,Android工作室无法编译我的主项目,因为找不到符号。这些符号可以在我的一个库项目中找到:https://code.google.com/p/android-lockpattern/(版本3.0.1)
这是错误消息之一
C:\projects\xxx.java:4: error: cannot find symbol
import group.pals.android.lib.ui.lockpattern.prefs.DisplayPrefs;
这是我奇怪的观察
:androidlockpattern:compileLint
:androidlockpattern:copyReleaseLint UP-TO-DATE
:androidlockpattern:preBuild
:androidlockpattern:preReleaseBuild
:androidlockpattern:checkReleaseManifest
:androidlockpattern:preDebugBuild
:androidlockpattern:preDebugTestBuild
:androidlockpattern:prepareComActionbarsherlockActionbarsherlock440Library UP-TO-DATE
:androidlockpattern:prepareReleaseDependencies
:androidlockpattern:compileReleaseAidl UP-TO-DATE
:androidlockpattern:compileReleaseRenderscript UP-TO-DATE
:androidlockpattern:generateReleaseBuildConfig UP-TO-DATE
:androidlockpattern:generateReleaseAssets UP-TO-DATE
:androidlockpattern:mergeReleaseAssets UP-TO-DATE
:androidlockpattern:generateReleaseResValues UP-TO-DATE
:androidlockpattern:generateReleaseResources UP-TO-DATE
:androidlockpattern:mergeReleaseResources UP-TO-DATE
:androidlockpattern:processReleaseManifest UP-TO-DATE
:androidlockpattern:processReleaseResources UP-TO-DATE
:androidlockpattern:generateReleaseSources UP-TO-DATE
:androidlockpattern:compileReleaseJava UP-TO-DATE
:androidlockpattern:proguardRelease UP-TO-DATE
:androidlockpattern:mergeReleaseProguardFiles UP-TO-DATE
:androidlockpattern:compileReleaseNdk UP-TO-DATE
:androidlockpattern:packageReleaseJniLibs UP-TO-DATE
:androidlockpattern:packageReleaseRenderscript UP-TO-DATE
:androidlockpattern:packageReleaseResources UP-TO-DATE
:androidlockpattern:bundleRelease
dependencies {
compile project(':androidlockpattern')
...
以下是详细的错误消息
C:\projects\xxx.java:4: error: cannot find symbol
import group.pals.android.lib.ui.lockpattern.prefs.DisplayPrefs;
^
symbol: class DisplayPrefs
location: package group.pals.android.lib.ui.lockpattern.prefs
C:\projects\xxx.java:195: error: cannot find symbol
Intent intent = new Intent(LockPatternActivity.ACTION_COMPARE_PATTERN, null,
^
symbol: variable ACTION_COMPARE_PATTERN
location: class LockPatternActivity
C:\projects\xxx.java:198: error: cannot find symbol
DisplayPrefs.setMaxRetry(this, Integer.MAX_VALUE);
^
symbol: variable DisplayPrefs
location: class JStockFragmentActivity
C:\projects\xxx.java:199: error: cannot find symbol
intent.putExtra(LockPatternActivity.EXTRA_PATTERN, startupLockPattern);
^
symbol: variable EXTRA_PATTERN
location: class LockPatternActivity
C:\projects\xxx.java:1239: error: cannot find symbol
case LockPatternActivity.RESULT_FAILED:
对于build.gradle
的{{1}},它看起来像以下
androidlockpattern
这是我的项目设置。对我来说似乎很好。
知道我可以采取哪些其他步骤来诊断根本原因?
答案 0 :(得分:1)
答案 1 :(得分:1)
根据Android文档:
ProGuard工具通过缩小,优化和混淆代码 删除未使用的代码并重命名类,字段和方法 语义晦涩的名字。
将runProguard true
更改为runProguard false
如果您想在项目上运行Proguard,则应相应更改proguard.cfg
。
此错误也可能适用于您:https://code.google.com/p/android/issues/detail?id=52962