0
Help us understand the problem. What are the problem?

posted at

updated at

ReactNativeのMainActivity.javaとかで"class、interfaceまたはenumがありません"が出るときの対処

症状

MainApplication.javaとかMainActivity.javaでこんなエラーが出る

...MainApplication.java:4: エラー: class、interfaceまたはenumがありません
package com.hoge.hoge;

(error: class, interface, or enum expected)

原因

packageが先頭じゃなくなってる

解決

packageを先頭に移動する

MainApplication/MainActivity.java
import hoge.fuga.hoge;
...
package com.hoge.hoge;
import hoge.piyo.hoge;
...

MainApplication/MainActivity.java
package com.hoge.hoge;
import hoge.fuga.hoge;
import hoge.piyo.hoge;
...

Register as a new user and use Qiita more conveniently

  1. You can follow users and tags
  2. you can stock useful information
  3. You can make editorial suggestions for articles
What you can do with signing up
0
Help us understand the problem. What are the problem?