2016-11-08 4 views
1

Android Studio를 사용하여 간단한 응용 프로그램을 만들고 있습니다. Andengine과 Andengine box2d 확장 라이브러리를 사용하고자 했으므로 jar 파일을 Project/apps/libs /로 복사하고 파일 - 프로젝트 구조 - 응용 프로그램 종속성 - 녹색 + 버튼 - 파일 종속성 - 두 개의 jar 파일을 추가했습니다. 코드의 내용은 매우 간단합니다 : 라이브러리를 가져 단지 새로운 physicsworld을 만드는Android 애플리케이션을 실행할 때 java.lang.UnsatisfiedLinkError

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()); 
    } 
} 
} 

이 내 build.gradle

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; 
을 실행할 때이 오류 메시지입니다

아무도 도움이 되십니까? > 빌드, 실행, 배포 - -

답변

1

이 내가 당신이

그냥 설정/환경 설정에서 인스턴트 실행을 반전시킬 수있는 희망 한 시도> 인스턴트 실행을하고 처음 두 체크 상자를 선택 해제 . 이 오류는 즉석 실행 기능 때문입니다.

+0

그것은 작동하지 않았다 .... –

+0

나는 혼란스러워했다. 실제로 작동했지만 다른 오류가 발생합니다. 어쨌든 고마워요 –

+0

내가 당신을 도울 수 있는지 알려주시겠습니까? – Kinjal

관련 문제