오류내용

Error:Execution failed for task ':app:processDebugManifest'.

> Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version 9 declared in library 


Suggestion: use tools:overrideLibrary="android.support.v4" to force usage



처리결과

build.gradle 파일에서

minSdkVersion 8

-> minSdkVersion 9

로 수정


<LinearLayout

    xmlns:android="http://schemas.android.com/apk/res/android"

    android:orientation="vertical"

    android:gravity="center_horizontal"

    android:layout_width="match_parent"

    android:layout_height="match_parent">


    <RelativeLayout

        android:id="@+id/layout_form"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_centerHorizontal="true"

        android:layout_centerVertical="true"

        android:layout_marginTop="120dp"

        >


        <TextView

            android:id="@+id/viewText_name"

            android:text="이      름"

            android:textSize="20dp"

            android:layout_width="100dp"

            android:layout_height="34dp"

            android:layout_marginRight="10dp"

            android:gravity="center_horizontal"

            />


        <EditText

            android:id="@+id/text_name"

            android:layout_width="150dp"

            android:layout_height="wrap_content"

            android:layout_toRightOf="@+id/viewText_name"

            android:layout_alignBaseline="@+id/viewText_name"

            android:maxLength="20"

            android:maxLines="1"

            android:inputType="text|textCapWords"

            />


        <TextView

            android:id="@+id/viewText_age"

            android:text="나      이"

            android:textSize="20dp"

            android:layout_width="100dp"

            android:layout_height="34dp"

            android:layout_marginRight="10dp"

            android:layout_below="@id/viewText_name"

            android:gravity="center_horizontal"

            />


        <EditText

            android:id="@+id/text_age"

            android:layout_width="150dp"

            android:layout_height="wrap_content"

            android:layout_toRightOf="@+id/viewText_age"

            android:layout_alignBaseline="@+id/viewText_age"

            android:maxLength="3"

            android:maxLines="1"

            android:inputType="number"

            />


        <TextView

            android:id="@+id/viewText_birthday"

            android:text="생년월일"

            android:layout_width="100dp"

            android:layout_height="34dp"

            android:layout_marginRight="10dp"

            android:layout_below="@id/viewText_age"

            android:textSize="20dp"

            android:gravity="center_horizontal"

            />

    </RelativeLayout>


    <Button

        android:id="@+id/button_birthday"

        android:layout_width="200dp"

        android:layout_height="wrap_content"

        android:onClick="onButtonBirthdayClicked"

        />


    <Button

        android:id="@+id/button_save"

        android:text="저 장"

        android:onClick="onButtonLoginClicked"

        android:layout_width="100dp"

        android:layout_height="wrap_content"

        android:layout_alignParentBottom="true"

        android:layout_marginTop="20dp"

        />

</LinearLayout>


public class MainActivity extends AppCompatActivity {

    TextView viewText_name;

    EditText text_name;


    TextView viewText_age;

    EditText text_age;


    TextView viewText_birthday;

    Button button_birthday;


    Button button_save;


    SimpleDateFormat sdf;


    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);


        viewText_name = (TextView) findViewById(R.id.viewText_name);

        text_name = (EditText) findViewById(R.id.text_name);

        viewText_age = (TextView) findViewById(R.id.viewText_age);

        text_age = (EditText) findViewById(R.id.text_age);

        viewText_birthday = (TextView) findViewById(R.id.viewText_birthday);

        button_birthday = (Button) findViewById(R.id.button_birthday);

        button_save = (Button) findViewById(R.id.button_save);


        sdf = new SimpleDateFormat("yyyy년 MM월 dd일");

        button_birthday.setText( sdf.format(Calendar.getInstance().getTime()) );

    }



    public void  onButtonBirthdayClicked(View v) {

        Calendar c = Calendar.getInstance();

        String today = button_birthday.getText().toString();

        if(today.length() == 13) {

            try {

                c.setTime(sdf.parse(today));

            } catch (ParseException e) {

            }

        }


        DatePickerDialog datePickerDialog = new DatePickerDialog(

                MainActivity.this,

                android.R.style.Theme_Holo_Light_Dialog_MinWidth,

                new OnDateSetListener() {

                    @Override

                    public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {

                        try {

                            Calendar calendar = Calendar.getInstance();

                            calendar.set(year, monthOfYear, dayOfMonth);

                            button_birthday.setText( sdf.format(calendar.getTime()) );

                        } catch (Exception e) {

                            e.printStackTrace();

                        }

                    }

                },

                c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH));


            datePickerDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);

            datePickerDialog.show();

        }



    public void onButtonLoginClicked(View v) {

        Toast toast = Toast.makeText(getBaseContext(),

                "이름 : " + text_name.getText() + ", " +

                "나이 : " + text_age.getText() + ", " +

                "생년월일 : " + button_birthday.getText(),

                Toast.LENGTH_LONG);


        toast.show();

    }

}



activity_main.xml


MainActivity.java


activity_menu.xml


MenuActivity.java


activity_customer_mng.xml, activity_sales_mng.xml, activity_customer_mng.xml


CustomerMngActivity.java


SalesMngActivity.java


ProductMngActivity.java


AndroidManifest.xml




오류메시지

Error: 'M' is not a valid file-based resource name character: File-based resource names must contain only lowercase a-z, 0-9, or underscore


원인

layout xml 파일명에 대문자 M을 사용했음

layout xml 파일명만 소문자, 숫자, _만 사용가능하는 그런 이야기


해결

파일명을 소문자로 바꿔주었다.


activity_main.xml

<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"

    >


    <RelativeLayout

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_centerHorizontal="true"

        android:layout_centerVertical="true"

        >


        <EditText

            android:id="@+id/textUser_ID"

            android:layout_width="150dp"

            android:layout_height="wrap_content"

            android:maxLength="20"

            android:maxLines="1"

            android:layout_marginBottom="10dp"

            android:layout_marginRight="10dp"

            android:hint="아이디"

            />


        <EditText

            android:id="@+id/textPassword"

            android:inputType="textPassword"

            android:layout_width="150dp"

            android:layout_height="wrap_content"

            android:layout_below="@id/textUser_ID"

            android:maxLength="40"

            android:maxLines="1"

            android:hint="비밀번호"

            />


        <Button

            android:id="@+id/buttonLogin"

            android:layout_width="wrap_content"

            android:layout_height="100dp"

            android:layout_alignBaseline="@id/textUser_ID"

            android:layout_toRightOf="@id/textUser_ID"

            android:onClick="onButtonLoginClicked"

            android:text="로그인" />


    </RelativeLayout>

</RelativeLayout>


MainActivity.java

public class MainActivity extends AppCompatActivity {

    public static final int REQUEST_CODE_ANOTHER = 1001;


    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

    }


    public void onButtonLoginClicked(View v) {

        Intent intent = new Intent(getBaseContext(), MenuActivity.class);

        startActivityForResult(intent, REQUEST_CODE_ANOTHER);


    }

}


activity_menu.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"

android:layout_height="match_parent"

>


<RelativeLayout

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_centerHorizontal="true"

android:layout_centerVertical="true"

>


<Button

android:id="@+id/buttonCustomerMng"

android:layout_width="180dp"

android:layout_height="wrap_content"

android:text="고객 관리"

android:textSize="22dp"

android:layout_marginBottom="10dp"

/>


<Button

android:id="@+id/buttonSalesMng"

android:layout_width="180dp"

android:layout_height="wrap_content"

android:text="매출 관리"

android:textSize="22dp"

android:layout_below="@id/buttonCustomerMng"

android:layout_marginBottom="10dp"

/>


<Button

android:id="@+id/buttonProductMng"

android:layout_width="180dp"

android:layout_height="wrap_content"

android:text="상품 관리"

android:textSize="22dp"

android:layout_below="@id/buttonSalesMng"

/>


</RelativeLayout>


</RelativeLayout>


MenuActivity.java

public class MenuActivity extends Activity {


    @Override

    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_menu);

    }

 

}


AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

    package="net.dev.mission03">


    <application

        android:allowBackup="true"

        android:icon="@mipmap/ic_launcher"

        android:label="@string/app_name"

        android:roundIcon="@mipmap/ic_launcher_round"

        android:supportsRtl="true"

        android:theme="@style/AppTheme">

        <activity android:name=".MainActivity">

            <intent-filter>

                <action android:name="android.intent.action.MAIN" />


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

            </intent-filter>

        </activity>


        <activity android:name=".MenuActivity">

        </activity>

    </application>


</manifest>


+ Recent posts