saturday06 / gradle-android-scala-plugin

gradle-android-scala-plugin adds scala language support to official gradle android plugin
Apache License 2.0
342 stars 64 forks source link

Member functions of Activity not found on clean Build #71

Open Nutomic opened 9 years ago

Nutomic commented 9 years ago

A clean build gives me the following errors. When I build a second time without cleaning, the build works. I tried to downgrade Gradle to 2.2.1, but that didn't help. All other dependencies/build tools use the versions listed in the Readme.

$ gradle assembleRelRelease
:app:preBuild
:app:preRelReleaseBuild
:app:checkRelReleaseManifest
:app:preDevDebugBuild
:app:preDevReleaseBuild
:app:preRelDebugBuild
:app:prepareComAndroidSupportAppcompatV72301Library
:app:prepareComAndroidSupportDesign2301Library
:app:prepareComAndroidSupportMultidex101Library
:app:prepareComAndroidSupportSupportV42301Library
:app:prepareRelReleaseDependencies
:app:compileRelReleaseAidl
:app:compileRelReleaseRenderscript
:app:generateRelReleaseBuildConfig
:app:generateRelReleaseAssets UP-TO-DATE
:app:mergeRelReleaseAssets
:app:generateRelReleaseResValues UP-TO-DATE
:app:generateRelReleaseResources
:app:mergeRelReleaseResources
:app:processRelReleaseManifest
:app:processRelReleaseResources
:app:generateRelReleaseSources
:app:processRelReleaseJavaRes UP-TO-DATE
:app:compileRelReleaseJavaWithJavac
Class android.support.v4.widget.DrawerLayoutImpl not found - continuing with a stub.
Class android.support.v4.app.BaseFragmentActivityHoneycomb not found - continuing with a stub.
Class android.support.v4.app.ActivityCompatApi23 not found - continuing with a stub.
Class android.support.v4.app.BaseFragmentActivityHoneycomb not found - continuing with a stub.
Unable to locate class corresponding to inner class entry for RequestPermissionsRequestCodeValidator in owner android.support.v4.app.ActivityCompatApi23
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/ConnectionsActivity.scala:24: type mismatch;
 found   : com.nutomic.ensichat.activities.ConnectionsActivity
 required: android.content.Context
  private lazy val database = new Database(this)
                                           ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/ConnectionsActivity.scala:26: type mismatch;
 found   : com.nutomic.ensichat.activities.ConnectionsActivity
 required: android.app.Activity
  private lazy val adapter = new UsersAdapter(this)
                                              ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/ConnectionsActivity.scala:36: not found: value findViewById
    val list = findViewById(android.R.id.list).asInstanceOf[ListView]
               ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/ConnectionsActivity.scala:44: type mismatch;
 found   : com.nutomic.ensichat.activities.ConnectionsActivity
 required: android.content.Context
    LocalBroadcastManager.getInstance(this)
                                      ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/ConnectionsActivity.scala:97: not found: value runOnUiThread
      runOnUiThread(new Runnable {
      ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/ConnectionsActivity.scala:57: type mismatch;
 found   : com.nutomic.ensichat.activities.ConnectionsActivity
 required: android.content.Context
    LocalBroadcastManager.getInstance(this).unregisterReceiver(onContactsUpdatedReceiver)
                                      ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/ConnectionsActivity.scala:66: not found: value getString
      val text = getString(R.string.contact_already_added, contact.name)
                 ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/ConnectionsActivity.scala:67: overloaded method value makeText with alternatives:
  (x$1: android.content.Context,x$2: Int,x$3: Int)android.widget.Toast <and>
  (x$1: android.content.Context,x$2: CharSequence,x$3: Int)android.widget.Toast
 cannot be applied to (com.nutomic.ensichat.activities.ConnectionsActivity, <error>, Int)
      Toast.makeText(this, text, Toast.LENGTH_SHORT).show()
            ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/ConnectionsActivity.scala:71: type mismatch;
 found   : com.nutomic.ensichat.activities.ConnectionsActivity
 required: android.content.Context
    new Builder(this)
                ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/ConnectionsActivity.scala:72: not found: value getString
      .setMessage(getString(R.string.dialog_add_contact, contact.name))
                  ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/ConnectionsActivity.scala:76: overloaded method value makeText with alternatives:
  (x$1: android.content.Context,x$2: Int,x$3: Int)android.widget.Toast <and>
  (x$1: android.content.Context,x$2: CharSequence,x$3: Int)android.widget.Toast
 cannot be applied to (com.nutomic.ensichat.activities.ConnectionsActivity, Int, Int)
          Toast.makeText(ConnectionsActivity.this, R.string.toast_contact_added, Toast.LENGTH_SHORT)
                ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/ConnectionsActivity.scala:86: type mismatch;
 found   : com.nutomic.ensichat.activities.ConnectionsActivity
 required: android.app.Activity
      NavUtils.navigateUpFromSameTask(this)
                                      ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/ConnectionsActivity.scala:89: value onOptionsItemSelected is not a member of com.nutomic.ensichat.activities.EnsichatActivity with android.widget.AdapterView.OnItemClickListener
      super.onOptionsItemSelected(item);
            ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/EnsichatActivity.scala:22: not found: value startService
    startService(new Intent(this, classOf[ChatService]))
    ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/EnsichatActivity.scala:22: overloaded method constructor Intent with alternatives:
  (x$1: android.content.Context,x$2: Class[_])android.content.Intent <and>
  (x$1: String,x$2: android.net.Uri)android.content.Intent
 cannot be applied to (com.nutomic.ensichat.activities.EnsichatActivity, Class[com.nutomic.ensichat.protocol.ChatService])
    startService(new Intent(this, classOf[ChatService]))
                 ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/EnsichatActivity.scala:23: not found: value bindService
    bindService(new Intent(this, classOf[ChatService]), this, Context.BIND_AUTO_CREATE)
    ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/EnsichatActivity.scala:23: overloaded method constructor Intent with alternatives:
  (x$1: android.content.Context,x$2: Class[_])android.content.Intent <and>
  (x$1: String,x$2: android.net.Uri)android.content.Intent
 cannot be applied to (com.nutomic.ensichat.activities.EnsichatActivity, Class[com.nutomic.ensichat.protocol.ChatService])
    bindService(new Intent(this, classOf[ChatService]), this, Context.BIND_AUTO_CREATE)
                ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/EnsichatActivity.scala:31: not found: value unbindService
    unbindService(this)
    ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/FirstStartActivity.scala:23: type mismatch;
 found   : com.nutomic.ensichat.activities.FirstStartActivity
 required: android.content.Context
  private lazy val preferences = PreferenceManager.getDefaultSharedPreferences(this)
                                                                               ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/FirstStartActivity.scala:24: not found: value getSystemService
  private lazy val imm = getSystemService(Context.INPUT_METHOD_SERVICE)
                         ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/FirstStartActivity.scala:27: not found: value findViewById
  private lazy val username = findViewById(R.id.username).asInstanceOf[EditText]
                              ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/FirstStartActivity.scala:28: not found: value findViewById
  private lazy val done     = findViewById(R.id.done)    .asInstanceOf[Button]
                              ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/FirstStartActivity.scala:39: not found: value setTitle
    setTitle(R.string.welcome)
    ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/FirstStartActivity.scala:79: overloaded method constructor Intent with alternatives:
  (x$1: android.content.Context,x$2: Class[_])android.content.Intent <and>
  (x$1: String,x$2: android.net.Uri)android.content.Intent
 cannot be applied to (com.nutomic.ensichat.activities.FirstStartActivity, Class[com.nutomic.ensichat.activities.MainActivity])
    val intent = new Intent(this, classOf[MainActivity])
                 ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/FirstStartActivity.scala:81: not found: value startActivity
    startActivity(intent)
    ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/FirstStartActivity.scala:82: not found: value finish
    finish()
    ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/MainActivity.scala:47: not found: value getIntent
    if (getIntent.getAction == MainActivity.ActionRequestBluetooth) {
        ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/MainActivity.scala:52: not found: value getIntent
      getIntent.setAction(null)
      ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/MainActivity.scala:55: not found: value getFragmentManager
    val fm = getFragmentManager
             ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/MainActivity.scala:81: not found: value getFragmentManager
    getFragmentManager.putFragment(outState, classOf[ContactsFragment].getName, contactsFragment)
    ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/MainActivity.scala:92: overloaded method value makeText with alternatives:
  (x$1: android.content.Context,x$2: Int,x$3: Int)android.widget.Toast <and>
  (x$1: android.content.Context,x$2: CharSequence,x$3: Int)android.widget.Toast
 cannot be applied to (com.nutomic.ensichat.activities.MainActivity, Int, Int)
          Toast.makeText(this, R.string.bluetooth_required, Toast.LENGTH_LONG).show()
                ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/MainActivity.scala:93: not found: value finish
          finish()
          ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/MainActivity.scala:102: not found: value getFragmentManager
    getFragmentManager
    ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/MainActivity.scala:115: not found: value getFragmentManager
      getFragmentManager
      ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/MainActivity.scala:117: not found: value getFragmentManager
        .remove(getFragmentManager.findFragmentById(android.R.id.content))
                ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/MainActivity.scala:122: not found: value setTitle
      setTitle(R.string.app_name)
      ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/MainActivity.scala:132: value onOptionsItemSelected is not a member of com.nutomic.ensichat.activities.EnsichatActivity
      super.onOptionsItemSelected(item);
            ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/SettingsActivity.scala:20: not found: value getFragmentManager
    val fm = getFragmentManager
             ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/SettingsActivity.scala:35: not found: value getFragmentManager
    getFragmentManager.putFragment(outState, "settings_fragment", fragment)
    ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/SettingsActivity.scala:40: type mismatch;
 found   : com.nutomic.ensichat.activities.SettingsActivity
 required: android.app.Activity
        NavUtils.navigateUpFromSameTask(this)
                                        ^
/home/felix/workspace/ensichat/app/src/main/scala/com/nutomic/ensichat/activities/SettingsActivity.scala:43: value onOptionsItemSelected is not a member of com.nutomic.ensichat.activities.EnsichatActivity
        super.onOptionsItemSelected(item);
              ^
Class javax.annotation.Nullable not found - continuing with a stub.
Class android.support.v4.app.NotificationBuilderWithActions not found - continuing with a stub.
Class android.support.v4.app.NotificationBuilderWithBuilderAccessor not found - continuing with a stub.
6 warnings found
43 errors found
:app:compileRelReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileRelReleaseScala'.
> Compilation failed

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 37.665 secs
optimumtact commented 9 years ago

Hello All, we're seeing a very similar issue to this, was there any found fix or resolution?

edit:Down to the exact same missing classes editedit: as the OP mentioned, you can sidestep the issue by triggering a gradle build twice, first clean, then nonclean

ntarocco commented 9 years ago

Same issue here. As workaround, I found you can manually add the internal_impl.jar, which you can find in the support library and it will work. It looks related to an issue in the android build tools provided by Google.