需要帮忙! Android IntelliJ错误无法解析R.raw无法找到符号(3) [英] Need Help! Android IntelliJ Errors Cannot resolve R.raw Cannot find symbols (3)
问题描述
我正在使用IntelliJ编码Android Moduble,我在尝试构建和编译程序时遇到这三个错误
错误:(22,24)java:找不到符号
符号:可变布局
位置:类com.scsvideo.ScSVideo
错误:(26,47)java:找不到符号
符号:变量id
位置:类com.scsvideo.ScSVideo
错误:(27,89)java:找不到符号
符号:变量原始
位置:类com.scsvideo.R
这是代码:
01
package com。 scsvideo;
02
03
import android.app.Activity;
04
导入android.net.Uri;
导入android.os.Bundle;
06
导入android.widget.MediaController;
07
导入android.widget.Toast;
08
导入android.widget.VideoView;
09
import com.scsvideo。*;
10
11
>
13
14
公共课ScSVideo扩展活动{
15
私人VideoView mVideoView;
16
/ **
$
*活动时调用首次创建。
18
* /
19
@Override
20
public void onCreate(Bundle savedInstanceState){
21
super.onCreate(savedInstanceState);
22
setContentView(layout.main);
23
24
Toast .makeText(getApplicationContext(),将设备转到侧面点击屏幕,Toast.LENGTH_LONG)。show();
25
26
mVideoView =(VideoView)findViewById(id.surface_view);
27
mVideoView.setVideoURI(Uri.parse(android.resource) :// + getPackageName()+/+ R.raw.s));
28
mVideoView.setMediaController(new MediaController(this));
29
mVideoView.requestFocus();
}
31
}
现在这里是主要的XML
01
02
< linearlayout xmlns:android =http://schemas.android.com/apk/res/android> 03
android:orientation =vertical
04
android:layout_width =match_parent
05
android:layout_height =match_parent>
06
07
< VideoView
08
android:id =@ + id / surface_view
$
android:layout_width =fill_parent
10
android:layout_height =fill_parent/>
11
12
13
下一个Android Manifest XML
14
15 br / >
< manifest xmlns:android =http://schemas.android.com/apk/res/android>
package = com.scsvideo
android:versionCode =1
18
android:versionName = 1.0>
19
< uses-sdk android:minsdkversion =22>
20
< application android:label =@ string / app_nameandroid:icon =@ drawable / ic_launcher>
21
< activity android: name =ScSVideo>
22
android:label =@ string / app_name>
23
< intent-filter>
< action android:name =android.intent.action.MAIN>
25
< category android:name =android.intent.category.LAUNCHER>
26
$
28
29
有人PLS PLS可以帮助我吗?
I am using IntelliJ coding Android Moduble and I get these three errors trying to build and compile my program
Error:(22, 24) java: cannot find symbol
symbol: variable layout
location: class com.scsvideo.ScSVideo
Error:(26, 47) java: cannot find symbol
symbol: variable id
location: class com.scsvideo.ScSVideo
Error:(27, 89) java: cannot find symbol
symbol: variable raw
location: class com.scsvideo.R
Here is the code:
01
package com.scsvideo;
02
03
import android.app.Activity;
04
import android.net.Uri;
05
import android.os.Bundle;
06
import android.widget.MediaController;
07
import android.widget.Toast;
08
import android.widget.VideoView;
09
import com.scsvideo.*;
10
11
12
13
14
public class ScSVideo extends Activity {
15
private VideoView mVideoView;
16
/**
17
* Called when the activity is first created.
18
*/
19
@Override
20
public void onCreate(Bundle savedInstanceState) {
21
super.onCreate(savedInstanceState);
22
setContentView(layout.main);
23
24
Toast.makeText(getApplicationContext(), "Turn device to side tap screen", Toast.LENGTH_LONG).show();
25
26
mVideoView = (VideoView) findViewById(id.surface_view);
27
mVideoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() +"/"+R.raw.s));
28
mVideoView.setMediaController(new MediaController(this));
29
mVideoView.requestFocus();
30
}
31
}
Now here is the main XML
01
02
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android">03
android:orientation="vertical"
04
android:layout_width="match_parent"
05
android:layout_height="match_parent">
06
07
<VideoView
08
android:id="@+id/surface_view"
09
android:layout_width="fill_parent"
10
android:layout_height="fill_parent"/>
11
12
13
Next Android Manifest XML
14
15
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
16
package="com.scsvideo"
17
android:versionCode="1"
18
android:versionName="1.0">
19
<uses-sdk android:minsdkversion="22">
20
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
21
<activity android:name="ScSVideo">
22
android:label="@string/app_name">
23
<intent-filter>
24
<action android:name="android.intent.action.MAIN">
25
<category android:name="android.intent.category.LAUNCHER">
26
27
28
29
Can someone PLS PLS help me?
推荐答案
您好,
如上面的朋友所说,请格式化你的代码。
现在我可以告诉你,例如你的代码片段:
Hello,
As friend above said, please format your code.
For now I can tell you that for example this fragment of your code:
mVideoView = (VideoView) findViewById(id.surface_view);
应该是这样的:
shoould be like this:
mVideoView = (VideoView) findViewById(R.id.surface_view);
希望它能以某种方式帮助你。
Hope it will somehow help you.
这篇关于需要帮忙! Android IntelliJ错误无法解析R.raw无法找到符号(3)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!