2016-11-08 10 views
1

私はAndroid Studioを使用しています。 AndengineとAndengineのbox2d拡張ライブラリを使いたいので、jarファイルをProject/apps/libs /にコピーし、File-Project Structure-app-dependencies-Green + Button - File Dependencyを実行して2つのjarファイルを追加しました。コードの 内容は非常に簡単です:ライブラリをインポートし、ちょうどこれが私のbuild.gradleAndroidアプリケーションを実行しているときにjava.lang.UnsatisfiedLinkError

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.0" 

    defaultConfig { 
     applicationId "es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid" 
     minSdkVersion 16 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:25.0.0' 
    compile files('libs/org_andengine_extension_physics_box2d.jar') 
    compile files('libs/org_andengine.jar') 
} 
apply plugin: 'com.android.application' 

であり、私は、このアプリケーション

java.lang.UnsatisfiedLinkError: com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader[DexPathList[[dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-support-annotations-25.0.0_ee7e9a33607a4b20cc7fc4a9de22e722aae9837b-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-org_andengine_extension_physics_box2d_0a0ee4336bdf5152c251673affd08f44e9819501-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-org_andengine_aa27347b199075e3e8eb7a180491e16195d84ba9-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-internal_impl-25.0.0_f6782dffbbfa20552c398cf53ac9deb2658c71ec-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-internal_impl-25.0.0_bc496c8bfa53dddde95ddc39cfb34a4fe2e39dea-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-internal_impl-25.0.0_b9082e72cbd30bc72a452a4c4514e7379a1d7184-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-internal_impl-25.0.0_9fa5df76df8f97a93d978537ed4a25cd9e8c55a8-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-internal_impl-25.0.0_05566ea662513b8bdb99b5532b5ac3e766ef24cd-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-com.android.support-support-vector-drawable-25.0.0_a5e795f5016d951f928483efae033259090a6f05-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-com.android.support-support-v4-25.0.0_24e2952335070557edc2f375decfb230cf7b5a0e-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-com.android.support-support-media-compat-25.0.0_1cea6c5351a7d50ff09f9f09de36eccfd70c73d7-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-com.android.support-support-fragment-25.0.0_dbb3c23bff1171b9e2d58b81c7c23fa2e11b3a4a-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-com.android.support-support-core-utils-25.0.0_f53d36752c5611401dc871b83261d909db44ba70-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-com.android.support-support-core-ui-25.0.0_3a815a7101840920878231e059c15ef73b846469-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-com.android.support-support-compat-25.0.0_d0220dcbe50daae00d9cb56a1c4446c6e55932b6-classes.dex", dex file "/data/data/es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid/files/instant-run/dex/slice-com.android.support-appcompat-v 
    package es.esy.m3na71jnu5cg5e2.gs14049_bsj_mid; 
を実行すると、このエラーメッセージである

import android.annotation.TargetApi; 
    import android.content.Context; 
    import android.graphics.Canvas; 
    import android.graphics.Color; 
    import android.graphics.Paint; 
    import android.graphics.RectF; 
    import android.graphics.drawable.shapes.RectShape; 
    import android.os.Bundle; 
    import android.os.Handler; 
    import android.os.Message; 
    import android.support.annotation.Nullable; 
    import android.support.v7.app.AppCompatActivity; 
    import android.util.DisplayMetrics; 
    import android.view.View; 
    import com.badlogic.gdx.math.Vector2; 
    import com.badlogic.gdx.physics.box2d.Body; 
    import com.badlogic.gdx.physics.box2d.BodyDef; 
    import com.badlogic.gdx.physics.box2d.CircleShape; 
    import com.badlogic.gdx.physics.box2d.Fixture; 
    import com.badlogic.gdx.physics.box2d.FixtureDef; 
    import com.badlogic.gdx.physics.box2d.PolygonShape; 
    import com.badlogic.gdx.physics.box2d.World; 

    import org.andengine.extension.physics.box2d.PhysicsWorld; 
    import java.util.ArrayList; 

public class PvPActivity extends AppCompatActivity implements View.OnClickListener{ 
PhysicsWorld world; 
ArrayList<Body> WhiteStoneArray,BlackStoneArray; 
GameView gameview; 
int ScreenWidth,ScreenHeight,radius; 
int UpMenuHeight,GameHeight,DownMenuHeight; 
int UpMenuY,GameY,DownMenuY; 
boolean playerturn=true; 
Handler mHandler=new Handler(){ 
    public void handleMessage(Message msg){ 
     gameview.invalidate(); 
     //world.step(0.01f,1,1); 
     mHandler.sendEmptyMessageDelayed(0,100); 
    } 
}; 
@Override 
protected void onCreate(@Nullable Bundle savedInstanceState) { 
    //pre-settings for View and some variables 
    super.onCreate(savedInstanceState); 
    gameview=new GameView(this); 
    setContentView(gameview); 
    WhiteStoneArray=new ArrayList<Body>(); 
    BlackStoneArray=new ArrayList<Body>(); 
    DisplayMetrics disp=getApplicationContext().getResources().getDisplayMetrics(); 
    ScreenWidth=disp.widthPixels; 
    ScreenHeight=disp.heightPixels; 
    //set variables about Screen Size 
    radius=ScreenHeight/20;//Set radius of stone = 5% of screen height 
    UpMenuY=0;//Begin of UpMenu Y coordinate 
    GameY=ScreenHeight/5;//Begin of GameView Y coordinate 
    DownMenuY=ScreenHeight*9/10;//Begin of DownMenu Y coordinate 
    UpMenuHeight=ScreenHeight/5;//Height of UpMenu = 20% of screen height 
    GameHeight=ScreenHeight*7/10;//Height of GameMenu = 70% of screen height 
    DownMenuHeight=ScreenHeight/5;//Height of DownMenu = 10% of screen height 


    //set Box2D World 
    world=new PhysicsWorld(new Vector2(0,-10f),true); 
    mHandler.sendEmptyMessage(0);//start Handler 
} 
class GameView extends View { 
    public GameView(Context context) { 
     super(context); 
    } 
    @Override 
    protected void onDraw(Canvas canvas) { 
     super.onDraw(canvas); 
     Paint p=new Paint(); 
     p.setAntiAlias(true); 
     canvas.drawText("Paint Test",0f,0f,p); 
    } 
    public void addNewStone(int x,int y){ 
     BodyDef StoneDef=new BodyDef(); 
     StoneDef.position.set(new Vector2(x,-y)); 
     Body StoneBody=world.createBody(StoneDef); 
     if(playerturn){ 
      WhiteStoneArray.add(StoneBody); 
      playerturn=false; 
     } 
     else{ 
      BlackStoneArray.add(StoneBody); 
      playerturn=true; 
     } 
     CircleShape StoneShape=new CircleShape(); 
     StoneShape.setRadius(radius); 
     FixtureDef StoneFixture=new FixtureDef(); 
     StoneFixture.density=1; 
     StoneFixture.friction=1; 
     StoneFixture.restitution=1; 
     StoneFixture.shape=StoneShape; 
     StoneBody.createFixture(StoneFixture); 
    } 
} 
@Override 
public void onClick(View view) { 
    if(GameY<=view.getY()&&GameY+GameHeight>=view.getY()){ 
     //gameview.addNewStone((int)view.getX(),(int)view.getY()); 
    } 
} 
} 

新しいphysicsworldを作ります

誰かが助けますか? > ビルド、実行、展開 - -

答えて

1

この私はそれはあなたが

だけの設定/プリファレンスからインスタント・ランをオフに役立つかもしれない願ってお試しください>インスタントファイル名を指定して実行し、最初の2 チェックボックスのチェックを外します。このエラーは、インスタント実行機能が原因です。

+0

それは動作しませんでした.... –

+0

を私は混乱していました。それは実際に働いたが、私は別のエラーが発生します。とにかくありがとう –

+0

私はあなたにお手伝いできるかどうかを教えてください – Kinjal

関連する問題