【问题标题】:Google Play Services Admob Migration - InjectView.value must be a constantGoogle Play 服务 Admob 迁移 - InjectView.value 必须是常量
【发布时间】:2014-10-09 19:05:21
【问题描述】:

我正在为 admobs 进行 Google Play 服务迁移,不幸的是,在将 Google Play 服务库实施到我的项目中时,我似乎碰壁了。

我的现有代码运行良好,但它似乎不喜欢 Google Play 服务库。

错误 - ''注解属性InjectView.value的值必须是常量表达式 '' -

@注入 私有数据源 mDataSource;

@InjectView(R.id.progress) 私有TextView mProgressTextView;

@InjectView(R.id.fragmentContainer) 私有 ViewGroup mFragmentContainer;

@InjectView(R.id.messages) 私人视图 mSoundWarning;

@InjectView(R.id.score) 私有TextView mScoreTextView;

谢谢,希望能帮到你

【问题讨论】:

  • 这样做消除了错误,我不知道如何或为什么。 @InjectView(tag="progress");
  • 不,它没有用。

标签: android eclipse admob google-play-services


【解决方案1】:

库项目在其 R 文件中不使用常量标识符。这使得在 @InjectView 注解中无法使用库项目 ID,因为注解需要常量值。

相反,使用视图标签来识别您的视图。

@InjectView(tag="foobar") TextView foobarView; 在你的布局中:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-03
    • 2019-12-01
    • 2014-01-19
    相关资源
    最近更新 更多