无法在根项目中为参数[:app]找到方法include()

时间:2015-06-17 08:17:47

标签: android android-activity gradle

1>失败:构建因异常而失败。

  

建立失败

     
      
  • 其中:
  •   
     

构建文件

     

'C:\ Users \ Poornima \ AndroidStudioProjects \ BooKmyTicket \ settings.gradle'line:1

     

总时间:2.629秒

     
      
  • 出了什么问题:
  •   
     

评估根项目'BooKmyTicket'时出现问题。

     

无法在根项目'BooKmyTicket'上找到参数[:app]的方法include()。

     
      
  • 尝试:   使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。   进程以退出代码1结束   

    setting.gradle

  •   
`include ':app`

login.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"
                android:background="@drawable/images"
               tools:context="gss.bookmyticket.LOGIN">
               <TextView
                android:id="@+id/fullscreen_content"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center"
                android:keepScreenOn="true"
                android:text=" "
                android:textStyle="bold" />
               <LinearLayout
                android:id="@+id/fullscreen_content_controls"
                style="?metaButtonBarStyle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|center_horizontal"
                tools:ignore="UselessParent" >
               </LinearLayout>
               <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:text="\n                             LOGIN \n"
                android:id="@+id/tTITLE"
                android:textColor="#FFFFFF"
                android:background="#009688"
                android:layout_alignParentTop="true"
                android:layout_alignParentStart="true"
                android:layout_alignParentEnd="true" />
               <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:text="PASSWORD"
                android:id="@+id/tPASSWORD"
                android:layout_alignTop="@+id/ePASSWORD1"
                android:layout_alignParentStart="true" />
                <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:text="USERNAME"
                android:id="@+id/tUSERNAME"
                android:layout_centerVertical="true"
                android:layout_alignParentStart="true" />
                <EditText
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:inputType="textPersonName"
                android:text="  USERNAME"
                android:background="#9E9E9E"
                android:ems="10"
                android:id="@+id/eUSERNAME1"
                android:layout_alignTop="@+id/tUSERNAME"
                android:layout_alignParentEnd="true" />
                <EditText
                 android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:inputType="textPassword"
                android:text="  password"
                android:ems="10"
                android:background="#9E9E9E"
                android:id="@+id/ePASSWORD1"
                android:layout_below="@+id/tUSERNAME"
                android:layout_alignParentEnd="true"
                android:layout_marginTop="37dp" />
               <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="  LOGIN   "
                android:id="@+id/bLogin"
                android:background="#0097A7"
                android:layout_alignParentBottom="true"
                android:layout_toStartOf="@+id/bRegister"
                android:layout_marginBottom="87dp" />
                <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="  REGISTER  "
                android:background="#0097A7"
                android:id="@+id/bRegister"
                android:layout_marginStart="60dp"
                android:layout_alignBottom="@+id/bLogin"
                android:layout_alignStart="@+id/ePASSWORD1" />
                </RelativeLayout>

register.xml

`<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      tools:context=".MainActivity"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="#00BCD4"
      android:orientation="vertical">
      <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="USERNAME"
        android:textColor="#FFFFFF"
        android:layout_marginTop="20dp"
        android:id="@+id/tUSERNAME" />
       <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textPersonName"
        android:text="enter name"
        android:ems="10"
        android:id="@+id/eUSERNAME1"
        android:textColor="#607D8B"
        android:layout_gravity="center_horizontal" />
       <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="PASSWORD"
        android:textColor="#FFFFFF"
        android:id="@+id/tPASSWORD" />
        <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/ePASSWORD1"
        android:textColor="#607D8B"
        android:text="enter password" />
        <TextView
        android:layout_width="84dp"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="EMAILID"
        android:textColor="#FFFFFF"
        android:id="@+id/tEMAILID" />
       <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textEmailAddress"
        android:ems="10"
        android:textColor="#607D8B"
        android:id="@+id/eEMAILID1"
        android:layout_gravity="center_horizontal"
        android:text="enter your emailid" />
       <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="PHNNO"
        android:textColor="#FFFFFF"
        android:id="@+id/tPHNNO" />
       <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="phone"
        android:ems="10"
        android:textColor="#607D8B"
        android:id="@+id/ePHNNO1"
        android:text="enter your phno" />
       <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="ADDRESS"
        android:textColor="#FFFFFF"
        android:id="@+id/tADDRESS" />
       <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textPostalAddress"
        android:ems="10"
        android:textColor="#607D8B"
        android:id="@+id/eADDRESS1"
        android:layout_gravity="center_horizontal"
        android:text="enter your postal address" />
       <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:text=" I ACCEPT TO TAKE RESPONSIBILITY FOR ANY ILLEGAL ACTIV
        ITIES .THE TICKET IS VALID FOR DATE BOOKED ONLY"
        android:id="@+id/tTEXT" />
       <CheckBox
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
        android:text="Please ,Accept TERMS AND CONDITIONS "
        android:textColor="#FFFFFF"
        android:id="@+id/checkBox"
        android:checked="false" />
       <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="  REGISTER  "
        android:textColor="#FFFFFF"
        android:id="@+id/bRegister"
        android:background="#9E9E9E"
        android:layout_gravity="center_horizontal" />
       </LinearLayout>`

login.java

`package gss.bookmyticket;
      import gss.bookmyticket.util.SystemUiHider;
      import android.annotation.TargetApi;
      import android.app.Activity;
      import android.content.Intent;
      import android.hardware.camera2.CameraCaptureSession;
      import android.os.Build;
      import android.os.Bundle;
      import android.os.Handler;
      import android.view.MotionEvent;
      import android.view.View;
      import android.widget.Button;
      import android.widget.EditText;
      import android.widget.TextView;
      import org.w3c.dom.Text;
      private SystemUiHider mSystemUiHider;
       @Override
       protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_login);
         bLOGIN = (Button) findViewById(R.id.bLogin);
         bREGISTER = (Button) findViewById(R.id.bRegister);
         eUSERNAME1 = (EditText) findViewById(R.id.eUSERNAME1);
         ePASSWORD1 = (EditText) findViewById(R.id.ePASSWORD1);
         tUSERNAME =(TextView) findViewById(R.id.tUSERNAME);
         tPASSWORD=(TextView) findViewById(R.id.tPASSWORD);
         tTITLE=(TextView) findViewById(R.id.tTITLE);
         bREGISTER.setOnClickListener(this);
         final View controlsView = 
              findViewById(R.id.fullscreen_content_controls); 
           final View contentView = findViewById(R.id.fullscreen_content);               
             mSystemUiHider = SystemUiHider.getInstance
                          (this, contentView, HIDER_FLAGS);
            mSystemUiHider.setup();
            mSystemUiHider
                .setOnVisibilityChangeListener(new SystemUiHide.OnVisibility
                     ChangeListener() {
                    // Cached values.
                    int mControlsHeight;
                    int mShortAnimTime;
                    @Override
                    @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
                    public void onVisibilityChange(boolean visible) {
                        if (Build.VERSION.SDK_INT >=
                        Build.VERSION_CODES.HONEYCOMB_MR2) {
                            // If the ViewPropertyAnimator API is available
                            // (Honeycomb MR2 and later), use it to animate the
                            // in-layout UI controls at the bottom of the
                            // screen.
                            if (mControlsHeight == 0) {
                                mControlsHeight = controlsView.getHeight();
                            }
                            if (mShortAnimTime == 0) {
                                mShortAnimTime = getResources().getInteger(
                                        android.R.integer.config_shortAnimTime);
                            }
                            controlsView.animate()
                                    .translationY(visible ? 0 : mControlsHeight)
                                    .setDuration(mShortAnimTime);
                        } else {
                            // If the ViewPropertyAnimator APIs aren't
                            // available, simply show or hide the in-layout UI
                            // controls.
                            controlsView.setVisibility(visible ?
                              View.VISIBLE : View.GONE);
                        }
                        if (visible && AUTO_HIDE) {
                            // Schedule a hide().
                            delayedHide(AUTO_HIDE_DELAY_MILLIS);
                        }
                    }
                });
        // Set up the user interaction to manually show or hide the system UI.
        contentView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (TOGGLE_ON_CLICK) {
                    mSystemUiHider.toggle();
                } else {
                    mSystemUiHider.show();
                }
            }
        });
        // Upon interacting with UI controls, delay any scheduled hide()
        // operations to prevent the jarring behavior of controls going away
        // while interacting with the UI.
      }
      @Override
        public void onClick(View v) {
        switch(v.getId()){
            case R.id.bRegister:
                startActivity(new Intent(this,REGISTER.class));
                break;
        }
        }
        @Override
        protected void onPostCreate(Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
        // Trigger the initial hide() shortly after the activity has been
        // created, to briefly hint to the user that UI controls
        // are available.
        delayedHide(100);
        }
       /**
       * Touch listener to use for in-layout UI controls to delay hiding the
        * system UI. This is to prevent the jarring behavior of controls
         going away
       * while interacting with activity UI.
       */
        View.OnTouchListener mDelayHideTouchListener =
         newView.OnTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if (AUTO_HIDE) {
                delayedHide(AUTO_HIDE_DELAY_MILLIS);
            }
            return false;
        }
        };
        Handler mHideHandler = new Handler();
        Runnable mHideRunnable = new Runnable() {
          @Override
           public void run() {
            mSystemUiHider.hide();
        }
        };
        /**
        * Schedules a call to hide() in [delay] milliseconds, canceling any
        * previously scheduled calls.
        */
       private void delayedHide(int delayMillis) {
        mHideHandler.removeCallbacks(mHideRunnable);
        mHideHandler.postDelayed(mHideRunnable, delayMillis);
       }
       }`

register.java

 `package gss.bookmyticket;
       import android.content.Intent;
       import android.support.v7.app.ActionBarActivity;
       import android.os.Bundle;
       import android.view.Menu;
       import android.view.MenuItem;
       import android.view.View;
       import android.widget.Button;
       import android.widget.CheckBox;
       import android.widget.EditText;
       import android.widget.TextView;
        public class REGISTER extends ActionBarActivity implements
        View.OnClickListener {
        Button bREGISTER;
        EditText eUSERNAME1, ePASSWORD1, eADDRESS1, ePHNNO1;
        TextView tUSERNAME, tPASSWORD, tTEXT, tADDRESS, tPHNNO;
        CheckBox checkBox;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        bREGISTER = (Button) findViewById(R.id.bRegister);
        eUSERNAME1 = (EditText) findViewById(R.id.eUSERNAME1);
        ePASSWORD1 = (EditText) findViewById(R.id.ePASSWORD1);
        eADDRESS1 = (EditText) findViewById(R.id.eADDRESS1);
        ePHNNO1 = (EditText) findViewById(R.id.ePHNNO1);
        tUSERNAME = (TextView) findViewById(R.id.tUSERNAME);
        tPASSWORD = (TextView) findViewById(R.id.tPASSWORD);
        tADDRESS = (TextView) findViewById(R.id.tADDRESS);
        tPHNNO = (TextView) findViewById(R.id.tPHNNO);
        tTEXT = (TextView) findViewById(R.id.tTEXT);
        checkBox = (CheckBox) findViewById(R.id.checkBox);
        bREGISTER.setOnClickListener(this);
       }

1 个答案:

答案 0 :(得分:0)

您应该删除冒号(':'),查看Gradle用户指南中的多项目构建example。如果将项目包含为依赖项,则使用冒号。