小编bo2*_*bo2的帖子

引起:java.lang.NoSuchMethodException:<init> [类android.content.Context,接口android.util.AttributeSet]

我运行我的应用程序时收到此错误.

错误:

 Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]
            at java.lang.Class.getConstructorOrMethod(Class.java:472)
            at java.lang.Class.getConstructor(Class.java:446)
            at android.view.LayoutInflater.createView(LayoutInflater.java:574)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702) 
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:398) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:354) 
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:366) 
            at android.app.Activity.setContentView(Activity.java:2031) 
            at com.example.syafiq.facialrecognition.Recognize_Face.onCreate(Recognize_Face.java:152)
Run Code Online (Sandbox Code Playgroud)

这里指出了Recognize_Face.java:152):

(line 148) protected void onCreate(Bundle savedInstanceState) {
    (line 149) Log.i(TAG, "called onCreate");
    (line 150) 1super.onCreate(savedInstanceState);
    (line 151) getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    (line 152) setContentView(R.layout.activity_recognize__face);
Run Code Online (Sandbox Code Playgroud)

我的activity_recognize_face.xml:

<?xml version="1.0" encoding="utf-8"?><RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#e7bc3a">

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_weight="0.88"
    android:orientation="vertical">

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_weight="0.88">

        <LinearLayout …
Run Code Online (Sandbox Code Playgroud)

android android-studio

22
推荐指数
2
解决办法
2万
查看次数

File.delete()被忽略

我目前有一些错误,它给了我空指针.所以这是代码.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.catalog_view);
    name = (TextView) findViewById(R.id.textView1);
    buttonDel = (Button) findViewById(R.id.buttonDel);
    buttonBack = (ImageButton) findViewById(R.id.imageButton1);


    mSwitcher = (ImageSwitcher) findViewById(R.id.switcher);
    mSwitcher.setFactory(this);
    mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
    mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));

    Bundle bundle = getIntent().getExtras();
    mPath = bundle.getString("path");

    thelabels = new labels(mPath);
    thelabels.Read();

    count = 0;
    int max = thelabels.max();
    for (int i = 0; i <= max; i++)
    {
        if (thelabels.get(i) != "") {
            count++;
        }
    }

    bmlist = new Bitmap[count];
    namelist = new String[count];
    count = 0;
    for …
Run Code Online (Sandbox Code Playgroud)

java android

5
推荐指数
1
解决办法
8933
查看次数

java.lang.UnsatisfiedLinkError:找不到本机方法:org.opencv.imgproc.Imgproc.rectangle_1

我目前正在开发面部识别的Android应用程序.所以我从github获得了一个源代码.它使用OpenCv,但源代码使用旧版本的OpenCv,我使用的是最新版本3.0.0.代码没有错误,并且它成功打开了应用程序,但是当我指向某个人的脸时,它突然停止了工作.

它给了我一个这样的错误:

 Process: com.example.syafiq.test, PID: 3249
 java.lang.UnsatisfiedLinkError: Native method not found: org.opencv.imgproc.Imgproc.rectangle_1:(JDDDDDDDDI)V
     at org.opencv.imgproc.Imgproc.rectangle_1(Native Method)
     at org.opencv.imgproc.Imgproc.rectangle(Imgproc.java:2779)
     at com.example.syafiq.test.FdActivity.onCameraFrame(FdActivity.java:431)
     at org.opencv.android.CameraBridgeViewBase.deliverAndDrawFrame(CameraBridgeViewBase.java:393)
     at org.opencv.android.JavaCameraView$CameraWorker.run(JavaCameraView.java:346)
     at java.lang.Thread.run(Thread.java:841)
Run Code Online (Sandbox Code Playgroud)

(Imgproc.java:2779)指出:

rectangle_1(img.nativeObj, pt1.x, pt1.y, pt2.x, pt2.y, color.val[0], color.val[1], color.val[2], color.val[3], thickness);
Run Code Online (Sandbox Code Playgroud)

(FdActivity.java:431)指出:

 (line430) for (int i = 0; i < facesArray.length; i++)
 (line431) Imgproc.rectangle(mRgba, facesArray[i].tl(), facesArray[i].br(), FACE_RECT_COLOR, 3);
Run Code Online (Sandbox Code Playgroud)

在此之前,(FdActivity.java:431)上的源代码是Core.rectangle,这是一个错误,所以我已经根据我发现修复该代码行的Internet将其更改为Imgproc.

On(CameraBridgeViewBase.java:393)指出:

(line392) if (mListener != null) {
(line393) modified = mListener.onCameraFrame(frame);
Run Code Online (Sandbox Code Playgroud)

On(JavaCameraView.java:346)指出:

(line345) if (!mFrameChain[1 - mChainIdx].empty())
(line346) deliverAndDrawFrame(mCameraFrame[1 - mChainIdx]);
Run Code Online (Sandbox Code Playgroud)

我是Android开发的新手,也是OpenCV的新手:/我感谢你的时间,并帮助我考虑帮助我.

提前致谢 :)

android opencv android-studio

0
推荐指数
1
解决办法
498
查看次数

Android Studio 不可达声明

我在编译我的项目时遇到问题,在事件日志中指出:

Error:(110, 9) error: unreachable statement
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint: deprecation for details.
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Run Code Online (Sandbox Code Playgroud)

代码:

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
    return inflater.inflate(R.layout.activity_analysis, container, false);
    InitializeAnalysisView(); // <-- [UNREACHABLE STATEMENT]
    return mRootView;
}

 private void InitializeAnalysisView(){
    mNameEditText = (EditText)mRootView.findViewById(R.id.editText_name2);
    mDescriptionEditText = (EditText)mRootView.findViewById(R.id.editText_descripion2);
    mGenderEditText = (EditText)mRootView.findViewById(R.id.editText_gender2);
    mProfileImageButton = (ImageButton)mRootView.findViewById(R.id.capture_image_button2);
    mProfileImageButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public …
Run Code Online (Sandbox Code Playgroud)

android android-studio

0
推荐指数
1
解决办法
1568
查看次数

标签 统计

android ×4

android-studio ×3

java ×1

opencv ×1