Unable to compile project with recyclerview-v7 dependency


#1

Hello

I am unable to compile my project with recyclerview-v7 dependency uncommented in the starter hello world js+nativescript template.

I am pretty new to nativescript and am unable to find any help for this topic on google.

I have updated all requirements. Have got the latest tns and android build tools and oreo.

I am using windows 10 x64 architecture.
without this dependency everything works fine.

and please tell what is this? until now I have understood that this lets us install app on android v < kitkat.

I have previously made an android app in android studio which used to add this package to support devices with lower android versions.

If I am wrong please correct me with this.
My main aim is to target all previous versions upto jellybean 4.1

when I build the project the output is :

F:\Ashish\Android\myProjects\HelloWorld>tns build android
Preparing projectā€¦
Successfully prepared plugin nativescript-theme-core for android.
Successfully prepared plugin tns-core-modules for android.
Successfully prepared plugin tns-core-modules-widgets for android.
Project successfully prepared (android)
Building projectā€¦
Gradle buildā€¦
+ applying user-defined configuration from F:\Ashish\Android\myProjects\HelloWorld\app\App_Resources\Android\app.gradle
+ adding nativescript runtime package dependency: nativescript-optimized
+ adding aar plugin dependency: F:\Ashish\Android\myProjects\HelloWorld\node_modules\tns-core-modules-widgets\platforms\android\widgets-release.aar
false
Running full build
F:\Ashish\Android\myProjects\HelloWorld\platforms\android\app\src\debug\java\com\tns\ErrorReportActivity.java:13: error: cannot access ActivityCompatApi23
public class ErrorReportActivity extends AppCompatActivity {
^
class file for android.support.v4.app.ActivityCompatApi23 not found
F:\Ashish\Android\myProjects\HelloWorld\platforms\android\app\src\debug\java\com\tns\ErrorReportActivity.java:15: error: cannot find symbol
setTheme(android.support.v7.appcompat.R.style.Theme_AppCompat_NoActionBar);
^
symbol: method setTheme(int)
location: class ErrorReportActivity
F:\Ashish\Android\myProjects\HelloWorld\platforms\android\app\src\debug\java\com\tns\ErrorReportActivity.java:17: error: cannot find symbol
super.onCreate(savedInstanceState);
^
symbol: variable super
location: class ErrorReportActivity
F:\Ashish\Android\myProjects\HelloWorld\platforms\android\app\src\debug\java\com\tns\ErrorReportActivity.java:19: error: cannot find symbol
new ErrorReport(this).buildUI();
^
symbol: variable this
location: class ErrorReportActivity
F:\Ashish\Android\myProjects\HelloWorld\platforms\android\app\src\debug\java\com\tns\ErrorReportActivity.java:22: error: method does not override or implement a method from a supertype
@Override
^
F:\Ashish\Android\myProjects\HelloWorld\platforms\android\app\src\debug\java\com\tns\ErrorReportActivity.java:24: error: cannot find symbol
super.onUserLeaveHint();
^
symbol: variable super
location: class ErrorReportActivity
F:\Ashish\Android\myProjects\HelloWorld\platforms\android\app\src\debug\java\com\tns\ErrorReportActivity.java:27: error: cannot find symbol
ErrorReport.killProcess(this);
^
symbol: variable this
location: class ErrorReportActivity
F:\Ashish\Android\myProjects\HelloWorld\platforms\android\app\src\debug\java\com\tns\ErrorReportActivity.java:40: error: cannot find symbol
Toast.makeText(this, ā€œCouldnā€™t resolve permissionsā€, Toast.LENGTH_LONG).show();
^
symbol: variable this
location: class ErrorReportActivity
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
8 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ā€˜:app:compileDebugJavaWithJavacā€™.

Compilation failed; see the compiler error output for details.

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

  • Get more help at https://help.gradle.org

BUILD FAILED in 2m 41s
Command gradlew.bat failed with exit code 1


Extend NativeScript's default WebViewClient implementation
Console.log behaves differently in node than in {N}
#2

The + notation for version in your dependency declaration is an anti-pattern and something we do not recommend.

Instead, you should check for the process property supportVersion and use that instead to avoid version clashes -

dependencies {
	def supportVer = "+"
	if (project.hasProperty("supportVersion")) {
		supportVer = supportVersion
	}

	compile "com.android.support:recyclerview-v7:$supportVer"
}

#3

Thank you sir. This came default in the starter template.

Will this script help me run my app on jellybean?


#4

It comes as a default, so that you can uncomment it and work on it, instead of wonder about the correct syntax.

Whether your project will run - that depends on a lot of factors. What do you plan on using the dependency for? Why are you concerned about your project not running on jellybean?


#5

Because I want to build a app for myself and I want to run that app on my all devices. One of my android is jellybean.

The app didnt install on that device.


#6

Hello thanks your solution worked. The project compiled,

but I am not able to install it on jellybean.

when I click the apk file on device ,it says ā€œThere is a problem parsing the packageā€

Please suggest how can I compile the app to run on jellybean


#7

@ashishbindal93

I am not sure we cleared that up but, which Jellybean is that? API 16 or API 17? The min Sdk version for all NativeScript applications is 17.


#8

I want to run on jelly bean 4.1.2 (Api 16)


#9

Any help with this problem will be grateful


#10

You canā€™t. The lowest that NativeScript supports is API 17.


#11

Thanks for the help.