android - 在根项目上找不到参数[:app]的方法include()

标签 android android-activity gradle

1>失败:生成失败,发生异常。

BUILD FAILED

  • Where:

Build file

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

Total time: 2.629 secs

  • What went wrong:

A problem occurred evaluating root project 'BooKmyTicket'.

Could not find method include() for arguments [:app] on root project 'BooKmyTicket'.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Process finished with exit code 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);
       }

最佳答案

您可能应该删除冒号(':'),查看Gradle用户指南中的Multi-project build example。如果您将项目包含为辅,则使用冒号。

关于android - 在根项目上找不到参数[:app]的方法include(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30885964/

相关文章:

android - Activity 中的静态内容

android - 当没有任何 Activity 在前台时停止服务

java - 在应用程序插件中调整 Gradle startScripts

android - 如果 Gradle 覆盖传递依赖项,我可以忽略 "Incompatible Gradle Versions"lint 检查吗?

android - 如何以编程方式连接到 Android 中的特定 Wi-Fi 网络?

java - 购物车产品即使从购物车中取出后仍保留

android - 单击搜索按钮时将关闭不可取消的对话框

java - 一个测试用例的测试数据反射(reflect)在另一个测试用例中

android - SYSTEM_UI_FLAG_LOW_PROFILE 不适用于 HTC One M8

java - 使用 2 个 Java 类显示 1 个 XML 文件的信息