With API 28 and “androidx.appcompat” library project says “AppCompatActivity” symbol not found










1















I updated my build and target version to 28 (Pie) and replaced the relevant dependencies. Now my project says Symbol not found on AppCompatActivity. I have tried to



  • Clean project

  • Rebuild project

  • Invalidate Caches / Restart

But the result is the same. Moreover when I try Ctrl+Space after extends keyword in activity class there is no "AppCompatActivity suggestion. I tried to investigate if its present in libraries folder, it's present there.



enter image description here



Now, what should I do to make it work? If there is any variation/alternative with androidx libs please let me know. Here is my complete build.gradle file



apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android
compileSdkVersion 28
defaultConfig
applicationId "com.invogen.messagingapp"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

buildTypes
release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'




dependencies
implementation fileTree(dir: 'libs', include: ['*.jar'])
// implementation 'com.android.support:appcompat-v7:28.0.0'
// implementation 'com.android.support.constraint:constraint-layout:1.1.3'
// implementation 'com.android.support:design:28.0.0'
// implementation 'com.android.support:support-v4:28.0.0'

// Libs for newer API 28
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0-alpha01'
implementation 'androidx.cardview:cardview:1.0.0'


testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

// Libs for Firebase Functionality
implementation 'com.google.firebase:firebase-core:16.0.5'
// implementation 'com.google.firebase:firebase-database:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-storage:16.0.4'

// Lib for Firebase UI Elements
implementation 'com.firebaseui:firebase-ui-database:4.2.1'

// Libs for QR Code
implementation 'com.google.zxing:core:3.2.1'
implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar'

// Lib for Circle Image View (Profile Image)
implementation 'de.hdodenhof:circleimageview:2.2.0'

// Lib for Loading Images
implementation 'com.squareup.picasso:picasso:2.71828'

//Lib for Cropping Images
api 'com.theartofdev.edmodo:android-image-cropper:2.8.+'



apply plugin: 'com.google.gms.google-services'


Some other posts suggest adding the below two parameters in Manifest file



android:appComponentFactory="anystrings be placeholder"
tools:replace="android:appComponentFactory"


But with these two lines project sync with multiple error and Android Studio says




Compilation failed; see the compiler error output for details.




If I have to add more detail to the question please let me know.










share|improve this question






















  • It worked for me, just make sure you have selected add unabmigious import on fly option from settings.

    – Karan Mer
    Nov 14 '18 at 7:20











  • @KaranMer, Yeah I know that and has already checked unambiguous import checkbox but don't know why android studio did not worked for me.

    – Inzimam Tariq IT
    Nov 14 '18 at 7:24











  • It might be problem with particular version of android studio. not sure though.

    – Karan Mer
    Nov 14 '18 at 7:25











  • @KaranMer, Anyway I has resolved this the hard way. Can you please answer stackoverflow.com/questions/53295106/…

    – Inzimam Tariq IT
    Nov 14 '18 at 7:34















1















I updated my build and target version to 28 (Pie) and replaced the relevant dependencies. Now my project says Symbol not found on AppCompatActivity. I have tried to



  • Clean project

  • Rebuild project

  • Invalidate Caches / Restart

But the result is the same. Moreover when I try Ctrl+Space after extends keyword in activity class there is no "AppCompatActivity suggestion. I tried to investigate if its present in libraries folder, it's present there.



enter image description here



Now, what should I do to make it work? If there is any variation/alternative with androidx libs please let me know. Here is my complete build.gradle file



apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android
compileSdkVersion 28
defaultConfig
applicationId "com.invogen.messagingapp"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

buildTypes
release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'




dependencies
implementation fileTree(dir: 'libs', include: ['*.jar'])
// implementation 'com.android.support:appcompat-v7:28.0.0'
// implementation 'com.android.support.constraint:constraint-layout:1.1.3'
// implementation 'com.android.support:design:28.0.0'
// implementation 'com.android.support:support-v4:28.0.0'

// Libs for newer API 28
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0-alpha01'
implementation 'androidx.cardview:cardview:1.0.0'


testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

// Libs for Firebase Functionality
implementation 'com.google.firebase:firebase-core:16.0.5'
// implementation 'com.google.firebase:firebase-database:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-storage:16.0.4'

// Lib for Firebase UI Elements
implementation 'com.firebaseui:firebase-ui-database:4.2.1'

// Libs for QR Code
implementation 'com.google.zxing:core:3.2.1'
implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar'

// Lib for Circle Image View (Profile Image)
implementation 'de.hdodenhof:circleimageview:2.2.0'

// Lib for Loading Images
implementation 'com.squareup.picasso:picasso:2.71828'

//Lib for Cropping Images
api 'com.theartofdev.edmodo:android-image-cropper:2.8.+'



apply plugin: 'com.google.gms.google-services'


Some other posts suggest adding the below two parameters in Manifest file



android:appComponentFactory="anystrings be placeholder"
tools:replace="android:appComponentFactory"


But with these two lines project sync with multiple error and Android Studio says




Compilation failed; see the compiler error output for details.




If I have to add more detail to the question please let me know.










share|improve this question






















  • It worked for me, just make sure you have selected add unabmigious import on fly option from settings.

    – Karan Mer
    Nov 14 '18 at 7:20











  • @KaranMer, Yeah I know that and has already checked unambiguous import checkbox but don't know why android studio did not worked for me.

    – Inzimam Tariq IT
    Nov 14 '18 at 7:24











  • It might be problem with particular version of android studio. not sure though.

    – Karan Mer
    Nov 14 '18 at 7:25











  • @KaranMer, Anyway I has resolved this the hard way. Can you please answer stackoverflow.com/questions/53295106/…

    – Inzimam Tariq IT
    Nov 14 '18 at 7:34













1












1








1








I updated my build and target version to 28 (Pie) and replaced the relevant dependencies. Now my project says Symbol not found on AppCompatActivity. I have tried to



  • Clean project

  • Rebuild project

  • Invalidate Caches / Restart

But the result is the same. Moreover when I try Ctrl+Space after extends keyword in activity class there is no "AppCompatActivity suggestion. I tried to investigate if its present in libraries folder, it's present there.



enter image description here



Now, what should I do to make it work? If there is any variation/alternative with androidx libs please let me know. Here is my complete build.gradle file



apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android
compileSdkVersion 28
defaultConfig
applicationId "com.invogen.messagingapp"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

buildTypes
release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'




dependencies
implementation fileTree(dir: 'libs', include: ['*.jar'])
// implementation 'com.android.support:appcompat-v7:28.0.0'
// implementation 'com.android.support.constraint:constraint-layout:1.1.3'
// implementation 'com.android.support:design:28.0.0'
// implementation 'com.android.support:support-v4:28.0.0'

// Libs for newer API 28
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0-alpha01'
implementation 'androidx.cardview:cardview:1.0.0'


testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

// Libs for Firebase Functionality
implementation 'com.google.firebase:firebase-core:16.0.5'
// implementation 'com.google.firebase:firebase-database:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-storage:16.0.4'

// Lib for Firebase UI Elements
implementation 'com.firebaseui:firebase-ui-database:4.2.1'

// Libs for QR Code
implementation 'com.google.zxing:core:3.2.1'
implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar'

// Lib for Circle Image View (Profile Image)
implementation 'de.hdodenhof:circleimageview:2.2.0'

// Lib for Loading Images
implementation 'com.squareup.picasso:picasso:2.71828'

//Lib for Cropping Images
api 'com.theartofdev.edmodo:android-image-cropper:2.8.+'



apply plugin: 'com.google.gms.google-services'


Some other posts suggest adding the below two parameters in Manifest file



android:appComponentFactory="anystrings be placeholder"
tools:replace="android:appComponentFactory"


But with these two lines project sync with multiple error and Android Studio says




Compilation failed; see the compiler error output for details.




If I have to add more detail to the question please let me know.










share|improve this question














I updated my build and target version to 28 (Pie) and replaced the relevant dependencies. Now my project says Symbol not found on AppCompatActivity. I have tried to



  • Clean project

  • Rebuild project

  • Invalidate Caches / Restart

But the result is the same. Moreover when I try Ctrl+Space after extends keyword in activity class there is no "AppCompatActivity suggestion. I tried to investigate if its present in libraries folder, it's present there.



enter image description here



Now, what should I do to make it work? If there is any variation/alternative with androidx libs please let me know. Here is my complete build.gradle file



apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android
compileSdkVersion 28
defaultConfig
applicationId "com.invogen.messagingapp"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

buildTypes
release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'




dependencies
implementation fileTree(dir: 'libs', include: ['*.jar'])
// implementation 'com.android.support:appcompat-v7:28.0.0'
// implementation 'com.android.support.constraint:constraint-layout:1.1.3'
// implementation 'com.android.support:design:28.0.0'
// implementation 'com.android.support:support-v4:28.0.0'

// Libs for newer API 28
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0-alpha01'
implementation 'androidx.cardview:cardview:1.0.0'


testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

// Libs for Firebase Functionality
implementation 'com.google.firebase:firebase-core:16.0.5'
// implementation 'com.google.firebase:firebase-database:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-storage:16.0.4'

// Lib for Firebase UI Elements
implementation 'com.firebaseui:firebase-ui-database:4.2.1'

// Libs for QR Code
implementation 'com.google.zxing:core:3.2.1'
implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar'

// Lib for Circle Image View (Profile Image)
implementation 'de.hdodenhof:circleimageview:2.2.0'

// Lib for Loading Images
implementation 'com.squareup.picasso:picasso:2.71828'

//Lib for Cropping Images
api 'com.theartofdev.edmodo:android-image-cropper:2.8.+'



apply plugin: 'com.google.gms.google-services'


Some other posts suggest adding the below two parameters in Manifest file



android:appComponentFactory="anystrings be placeholder"
tools:replace="android:appComponentFactory"


But with these two lines project sync with multiple error and Android Studio says




Compilation failed; see the compiler error output for details.




If I have to add more detail to the question please let me know.







android android-studio gradle appcompat androidx






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 11:24









Inzimam Tariq ITInzimam Tariq IT

4,20562350




4,20562350












  • It worked for me, just make sure you have selected add unabmigious import on fly option from settings.

    – Karan Mer
    Nov 14 '18 at 7:20











  • @KaranMer, Yeah I know that and has already checked unambiguous import checkbox but don't know why android studio did not worked for me.

    – Inzimam Tariq IT
    Nov 14 '18 at 7:24











  • It might be problem with particular version of android studio. not sure though.

    – Karan Mer
    Nov 14 '18 at 7:25











  • @KaranMer, Anyway I has resolved this the hard way. Can you please answer stackoverflow.com/questions/53295106/…

    – Inzimam Tariq IT
    Nov 14 '18 at 7:34

















  • It worked for me, just make sure you have selected add unabmigious import on fly option from settings.

    – Karan Mer
    Nov 14 '18 at 7:20











  • @KaranMer, Yeah I know that and has already checked unambiguous import checkbox but don't know why android studio did not worked for me.

    – Inzimam Tariq IT
    Nov 14 '18 at 7:24











  • It might be problem with particular version of android studio. not sure though.

    – Karan Mer
    Nov 14 '18 at 7:25











  • @KaranMer, Anyway I has resolved this the hard way. Can you please answer stackoverflow.com/questions/53295106/…

    – Inzimam Tariq IT
    Nov 14 '18 at 7:34
















It worked for me, just make sure you have selected add unabmigious import on fly option from settings.

– Karan Mer
Nov 14 '18 at 7:20





It worked for me, just make sure you have selected add unabmigious import on fly option from settings.

– Karan Mer
Nov 14 '18 at 7:20













@KaranMer, Yeah I know that and has already checked unambiguous import checkbox but don't know why android studio did not worked for me.

– Inzimam Tariq IT
Nov 14 '18 at 7:24





@KaranMer, Yeah I know that and has already checked unambiguous import checkbox but don't know why android studio did not worked for me.

– Inzimam Tariq IT
Nov 14 '18 at 7:24













It might be problem with particular version of android studio. not sure though.

– Karan Mer
Nov 14 '18 at 7:25





It might be problem with particular version of android studio. not sure though.

– Karan Mer
Nov 14 '18 at 7:25













@KaranMer, Anyway I has resolved this the hard way. Can you please answer stackoverflow.com/questions/53295106/…

– Inzimam Tariq IT
Nov 14 '18 at 7:34





@KaranMer, Anyway I has resolved this the hard way. Can you please answer stackoverflow.com/questions/53295106/…

– Inzimam Tariq IT
Nov 14 '18 at 7:34












2 Answers
2






active

oldest

votes


















0














With Clean and build and Rebuild project android studio did not clean the unused imports like imports from android.support.v7 so I removed them all manually from all activities. Now android studio suggests AppCompatActivity from the correct library.



Hope so it will help someone.






share|improve this answer






























    0














    you should replace the target class.



    eg.



    import android.support.v7.app.AppCompatActivity;


    replace to :



    import androidx.appcompat.app.AppCompatActivity;





    share|improve this answer






















      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279989%2fwith-api-28-and-androidx-appcompat-library-project-says-appcompatactivity-sy%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      With Clean and build and Rebuild project android studio did not clean the unused imports like imports from android.support.v7 so I removed them all manually from all activities. Now android studio suggests AppCompatActivity from the correct library.



      Hope so it will help someone.






      share|improve this answer



























        0














        With Clean and build and Rebuild project android studio did not clean the unused imports like imports from android.support.v7 so I removed them all manually from all activities. Now android studio suggests AppCompatActivity from the correct library.



        Hope so it will help someone.






        share|improve this answer

























          0












          0








          0







          With Clean and build and Rebuild project android studio did not clean the unused imports like imports from android.support.v7 so I removed them all manually from all activities. Now android studio suggests AppCompatActivity from the correct library.



          Hope so it will help someone.






          share|improve this answer













          With Clean and build and Rebuild project android studio did not clean the unused imports like imports from android.support.v7 so I removed them all manually from all activities. Now android studio suggests AppCompatActivity from the correct library.



          Hope so it will help someone.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 '18 at 6:56









          Inzimam Tariq ITInzimam Tariq IT

          4,20562350




          4,20562350























              0














              you should replace the target class.



              eg.



              import android.support.v7.app.AppCompatActivity;


              replace to :



              import androidx.appcompat.app.AppCompatActivity;





              share|improve this answer



























                0














                you should replace the target class.



                eg.



                import android.support.v7.app.AppCompatActivity;


                replace to :



                import androidx.appcompat.app.AppCompatActivity;





                share|improve this answer

























                  0












                  0








                  0







                  you should replace the target class.



                  eg.



                  import android.support.v7.app.AppCompatActivity;


                  replace to :



                  import androidx.appcompat.app.AppCompatActivity;





                  share|improve this answer













                  you should replace the target class.



                  eg.



                  import android.support.v7.app.AppCompatActivity;


                  replace to :



                  import androidx.appcompat.app.AppCompatActivity;






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 29 at 6:46









                  iamcxliamcxl

                  7410




                  7410



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279989%2fwith-api-28-and-androidx-appcompat-library-project-says-appcompatactivity-sy%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

                      Darth Vader #20

                      Ondo