无法在 Android Studio 中为 SciChart 设置许可证密钥
Cannot set License key for SciChart in AndroidStudio
各位。
最近,我获得了 SciChart Android v2x 的试用许可密钥。
我阅读了很多次教程来设置许可证(https://www.scichart.com/licensing-scichart-android/),但无法激活我的许可证。
因为没有写在哪个文件应该写license code。
所以我试着把它写在我的应用程序的 MainActivity.java 文件中,如下所示
package com.example.my5;
import android.os.Bundle;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
...
import com.scichart.charting.visuals.SciChartSurface;
import com.scichart.charting.visuals.axes.IAxis;
...
public class MainActivity extends AppCompatActivity {
private AppBarConfiguration mAppBarConfiguration;
String license = ("<LicenseContract>\n" +
" <Customer>nnuni@mail.ru</Customer>\n" +
" <OrderId>Trial</OrderId>\n" +
" <LicenseCount>1</LicenseCount>\n" +
" <IsTrialLicense>true</IsTrialLicense>\n" +
" <SupportExpires>12/31/2019 00:00:00</SupportExpires>\n" +
" <ProductCode>SC-ANDROID-2D-ENTERPRISE-SRC</ProductCode>\n" +
" <KeyCode>28a24cba44.........8a6c</KeyCode>\n" +
"</LicenseContract>");
// Use Static method SciChartSurface.setRuntimeLicenseKey()
SciChartSurface.setRuntimeLicenseKey(license);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
DrawerLayout drawer = findViewById(R.id.drawer_layout);
NavigationView navigationView = findViewById(R.id.nav_view);
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
mAppBarConfiguration = new AppBarConfiguration.Builder(
R.id.nav_home, R.id.nav_gallery, R.id.nav_slideshow,
R.id.nav_tools, R.id.nav_share, R.id.nav_send)
.setDrawerLayout(drawer)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
NavigationUI.setupWithNavController(navigationView, navController);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onSupportNavigateUp() {
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
return NavigationUI.navigateUp(navController, mAppBarConfiguration)
|| super.onSupportNavigateUp();
}
}
但它给我错误:"Cannot resolve symbol"。请帮忙。
我是 android 工作室的新人。
提前致谢
许可证的代码和用法是正确的。将许可证密钥发送给 Scichart 支持,他们可以检查它是否有效或已损坏。他们还将能够就此类问题提出更好的建议。
各位。 最近,我获得了 SciChart Android v2x 的试用许可密钥。 我阅读了很多次教程来设置许可证(https://www.scichart.com/licensing-scichart-android/),但无法激活我的许可证。 因为没有写在哪个文件应该写license code。 所以我试着把它写在我的应用程序的 MainActivity.java 文件中,如下所示
package com.example.my5;
import android.os.Bundle;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
...
import com.scichart.charting.visuals.SciChartSurface;
import com.scichart.charting.visuals.axes.IAxis;
...
public class MainActivity extends AppCompatActivity {
private AppBarConfiguration mAppBarConfiguration;
String license = ("<LicenseContract>\n" +
" <Customer>nnuni@mail.ru</Customer>\n" +
" <OrderId>Trial</OrderId>\n" +
" <LicenseCount>1</LicenseCount>\n" +
" <IsTrialLicense>true</IsTrialLicense>\n" +
" <SupportExpires>12/31/2019 00:00:00</SupportExpires>\n" +
" <ProductCode>SC-ANDROID-2D-ENTERPRISE-SRC</ProductCode>\n" +
" <KeyCode>28a24cba44.........8a6c</KeyCode>\n" +
"</LicenseContract>");
// Use Static method SciChartSurface.setRuntimeLicenseKey()
SciChartSurface.setRuntimeLicenseKey(license);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
DrawerLayout drawer = findViewById(R.id.drawer_layout);
NavigationView navigationView = findViewById(R.id.nav_view);
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
mAppBarConfiguration = new AppBarConfiguration.Builder(
R.id.nav_home, R.id.nav_gallery, R.id.nav_slideshow,
R.id.nav_tools, R.id.nav_share, R.id.nav_send)
.setDrawerLayout(drawer)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
NavigationUI.setupWithNavController(navigationView, navController);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onSupportNavigateUp() {
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
return NavigationUI.navigateUp(navController, mAppBarConfiguration)
|| super.onSupportNavigateUp();
}
}
但它给我错误:"Cannot resolve symbol"。请帮忙。 我是 android 工作室的新人。 提前致谢
许可证的代码和用法是正确的。将许可证密钥发送给 Scichart 支持,他们可以检查它是否有效或已损坏。他们还将能够就此类问题提出更好的建议。