我最近将我的 Android Studio 版本更新为 2.3。一切正常,但除了我在build.gradle
.
我打算做什么:
我想在我的项目中使用基于注释的 Permission Dispatcher 库,但我无法成功构建我的项目,因为 gradle 在构建错误后抛出
Error:(14, 9) error: cannot find symbol variable MainActivityPermissionsDispatcher
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
我的代码:
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/* Couldn't import MainActivityPermissionsDispatcher
import in my code since it is throwing error as stated above */
MainActivityPermissionsDispatcher.showCameraWithCheck(this);
}
}
我的 build.gradle
:
ext{
permissionDispatcherVersion = '2.3.2'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.1'
testCompile 'junit:junit:4.12'
compile "com.github.hotchemi:permissionsdispatcher:$permissionDispatcherVersion"
annotationProcessor "com.github.hotchemi:permissionsdispatcher-processor:$permissionDispatcherVersion"
}
我尝试了什么:
我尝试在 Android Studio 首选项中启用注释处理器,如下所示在 Android Studio 2.2 中启用注释处理器选项中找到的建议
任何形式的线索或建议都会非常有帮助。由于找不到任何解决方法,我已经被这个问题困扰了超过 2 天。提前致谢。