JNI错误发生在android工作室

时间:2018-06-02 11:03:52

标签: java android android-studio xampp webserver

此代码是我正在处理的应用程序的一部分。这个应用程序是基于eclipse在较低版本的android上建立的,我现在使它兼容更高版本的android(8),我正在使用android studio。这个应用程序将数据发送到Web服务器(我正在使用Xampp)并进行一些计算。 在运行php文件时,这是我得到的错误。

This is the error I am getting

这是我得到的错误。

我正在运行的特定代码 -

package com.majdan.sensoranalyzer;

import java.util.LinkedList;
import java.util.List;

import com.majdan.sensordynamics.FixedKeystrokeContainer2;

public class GraphData extends Data {
    private static final long serialVersionUID = 354054054054L;
    int graphType;

    public GraphData(int graphType, int label, List<? extends Arrayzable> l) {
        this.graphType = graphType;
        this.label = label;

        int length = 0;
        for (Arrayzable fd : l) {
            length += fd.getArrayData().length;
        }

        this.floatData = new Float[length];

        int i = 0;
        for (Arrayzable fd : l) {
            Float[] arr = fd.getArrayData();
            for (int j = 0; j < arr.length; j++) {
                this.floatData[i++] = arr[j];
            }
        }
    }

    public GraphData(int graphType, int step, boolean splitPressRelease, int label, FixedKeystrokeContainer2 fkc,
            DataSettings settings) {
        this.graphType = graphType;
        this.label = label;

        int graphTypeAbs = (graphType > 0 ? graphType : -graphType);

        FixedKeystrokeContainer2[] parts = fkc.splitKeystrokes();
        if (graphTypeAbs > parts.length)
            throw new RuntimeException("keystroke parts is to short for graphType=" + graphType);

        FixedKeystrokeContainer2[] data = generateGraphs(graphType, step, splitPressRelease, parts);
        // System.out.println("######## "+data.length);
        // for(FixedKeystrokeContainer2 d : data) {
        // System.out.println("---------- "+(d.getKeyDownsUps().size()-1));
        // System.out.println(d.printKeystrokes());
        // //System.out.println("\r\n");
        // }
        FreeData[] freeData = new FreeData[data.length];
        int floatDataSize = 0;
        for (int i = 0; i < data.length; i++) {
            freeData[i] = new FreeData(label, data[i], settings);
            floatDataSize += freeData[i].getArrayData().length;
        }

        this.floatData = new Float[floatDataSize];
        this.floatLabels = new String[floatData.length];
        int i = 0;
        int j = 0;
        for (FreeData fd : freeData) {
            for (Float v : fd.getArrayData()) {

                this.floatData[i++] = v;

            }
            for (String fl : fd.getFloatLabels())
                this.floatLabels[j++] = fl;
        }
    }

    private FixedKeystrokeContainer2[] generateGraphs(int graphType, int step, boolean splitPressRelease,
            FixedKeystrokeContainer2[] data) {
        if (graphType == 0) {
            return data;
        }

        FixedKeystrokeContainer2[][] graphsChopped = generateGraphs(graphType, step, data);

        if (!splitPressRelease) {
            FixedKeystrokeContainer2[] result = new FixedKeystrokeContainer2[graphsChopped.length];
            for (int i = 0; i < result.length; i++) {
                result[i] = new FixedKeystrokeContainer2(graphsChopped[i]);
            }
            return result;

        } else {
            LinkedList<FixedKeystrokeContainer2> result = new LinkedList<FixedKeystrokeContainer2>();
            for (int i = 0; i < graphsChopped.length; i++) {
                LinkedList<FixedKeystrokeContainer2> pressesOrReleasesA = new LinkedList<FixedKeystrokeContainer2>();
                LinkedList<FixedKeystrokeContainer2> pressesOrReleasesB = new LinkedList<FixedKeystrokeContainer2>();
                for (int j = 0; j < graphsChopped[i].length; j++) {
                    if (j % 2 == 0) {
                        pressesOrReleasesA.add(graphsChopped[i][j]);
                    } else {
                        pressesOrReleasesB.add(graphsChopped[i][j]);
                    }
                }

                result.add(new FixedKeystrokeContainer2(pressesOrReleasesA));
                result.add(new FixedKeystrokeContainer2(pressesOrReleasesB));
            }

            return result.toArray(new FixedKeystrokeContainer2[0]);
        }
    }

    private FixedKeystrokeContainer2[][] generateGraphs(int graphType, int step, FixedKeystrokeContainer2[] data) {
        if (graphType == 0) {
            throw new RuntimeException("assert(graphType!=0)");
        }

        boolean forwardKeystroke = graphType >= 0;
        int graphTypeLength = 1 + (graphType > 0 ? graphType : -graphType);

        LinkedList<FixedKeystrokeContainer2[]> result = new LinkedList<FixedKeystrokeContainer2[]>();
        for (int i = forwardKeystroke ? 0 : 1; i + graphTypeLength <= data.length; i += step) {
            FixedKeystrokeContainer2[] graph = new FixedKeystrokeContainer2[graphTypeLength];
            for (int j = 0; j < graphTypeLength; j++) {
                graph[j] = data[i + j];
            }
            result.add(graph);
        }

        return result.toArray(new FixedKeystrokeContainer2[0][]);
    }
}

这是清单文件

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
        package="com.android.inputmethoddl.latin" android:versionName="DynLog">
    <uses-permission android:name="android.permission.VIBRATE"/>
    <uses-permission android:name="android.permission.READ_USER_DICTIONARY" />
    <uses-permission android:name="android.permission.WRITE_USER_DICTIONARY" />
    <uses-permission android:name="android.permission.BACKUP_DATA" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />


    <uses-sdk
    android:minSdkVersion="22"
    android:targetSdkVersion="27"  />
      <!-- higher version are not supported but it can easily be done -->


    <application android:label="@string/english_ime_name"
            android:killAfterRestore="false" >
          <!--   android:debuggable="true"-->

        <service android:name="LatinIME"
                android:label="@string/english_ime_name"
                android:permission="android.permission.BIND_INPUT_METHOD">
            <intent-filter>
                <action android:name="android.view.InputMethod" />
            </intent-filter>
            <meta-data android:name="android.view.im" android:resource="@xml/method" />
        </service>

        <activity android:name="LatinIMESettings" android:label="@string/english_ime_settings">
            <intent-filter>

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

         <activity android:name="com.majdan.sensordynamics.FirstActivity" android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />    
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
         <activity 
             android:name="com.majdan.sensordynamics.AuthenticationActivity" 
             android:label="@string/authentication"
             android:screenOrientation="landscape" 
             android:windowSoftInputMode="adjustNothing"
             >
        </activity>

        <activity
            android:screenOrientation="landscape"
            android:name="com.majdan.sensordynamics.FixedActivity"
            android:label="@string/app_name" >
       <!--     android:windowSoftInputMode="adjustResize"  -->
       <!-- can be added in case of bigger keyboard -->

        </activity>

    </application>
</manifest>

0 个答案:

没有答案
相关问题