packages not found but added in libraries...

Answered

This is my code.

package com.example.syn.coinpay;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import org.bitcoinj.core.Context;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.core.Peer;
import org.bitcoinj.core.listeners.DownloadProgressTracker;
import org.bitcoinj.kits.WalletAppKit;
import org.bitcoinj.params.BCCTestNet3Params;
import org.bitcoinj.params.TestNet3Params;

import java.io.File;
import java.util.Date;

public class mainpage extends AppCompatActivity{
public static NetworkParameters BTCparams = TestNet3Params.get();
public static WalletAppKit BTCkit = new WalletAppKit(BTCparams,new File("."),"BTC-Test");
public static NetworkParameters BCHparams = BCCTestNet3Params.get();
public static WalletAppKit BCHkit = new WalletAppKit(BCHparams,new File("."),"BCH-Test");
public static Double handleFee = 0.035;
public static String handleAddress = "mtcH4NTs32vDRRemz6DotHYokn5zRHWxRY";
static private Integer productid = 1;
static Object[] account = backend.account(productid);
static String[] server = backend.select("SELECT rates, status, contact, provider FROM server");

@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
hideSystemUI();
}
}

private void hideSystemUI() {
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN);
}

@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.mainpage);
hideSystemUI();
Toast.makeText(getApplicationContext(),"Account : "+account[1],Toast.LENGTH_LONG).show();
Button but = findViewById(R.id.button);
Context.propagate(new Context(BTCparams));
DownloadProgressTracker BTCListener = new DownloadProgressTracker() {
@Override
public void onChainDownloadStarted(Peer peer, int blocksLeft){
Toast.makeText(getApplicationContext(),"Syncing",Toast.LENGTH_LONG).show();
}
@Override
public void progress(double pct, int blocksSoFar, Date date) {
System.out.println(backend.strFormat("GOOD", "BTC", "GOOD", "BlockChain " + (int) pct + "%"));
//Diagnostic.BTCProgress = (int) pct;
}

@Override
public void doneDownload() {
System.out.println(backend.strFormat("PASS", "BTC", "PASS", "BlockChain Complete"));
//Diagnostic.BTCProgress = 100;
Toast.makeText(getApplicationContext(),"Done Syncing",Toast.LENGTH_LONG).show();
}
};
BTCkit.setDownloadListener(BTCListener).setBlockingStartup(false).startAsync().awaitRunning();
}
}
 
The above is 2 classes im working on android. I added the libraryes for sarxos, bitcoinj, etc.. All the errors are related to not finding those libraries.

the error output is...

error: cannot find symbol variable Context
 

 

 

these are the build errors im getting.

 

I also verified in project structure > libraries the jars are still there and the directories sre valid.

 

Now when i use the same code in my older versioon of this software it works fine.

 

What am i missing?

0
4 comments

Can you build the project by Gradle from command line?

Try re-importing project anew via File | New | Project from Existing Sources and select main build.gradle file to import from.

0
Avatar
Permanently deleted user

There is no build.gradle.

 

I have jars only

0

Check that the libraries for modules (Dependencies tab) are properly attached and check (in libraries settings) that the library jars are not missing.

If issue remains, please provide a project to check.

0
Avatar
Permanently deleted user

apologies i found the gradle, im still learning this new android way.

 

i ran gradle build and got these results.

 

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

0

Please sign in to leave a comment.